You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IVIewFor is used to link a View to a ViewModel, this is used to link the ViewModel to the View in a way that ReactiveUI can use it to bind the ViewModel to the View.
262
+
The ViewModel is passed as a string to the IViewFor Attribute.
263
+
The class must inherit from a UI Control from any of the following platforms and namespaces:
264
+
- Maui (Microsoft.Maui)
265
+
- WinUI (Microsoft.UI.Xaml)
266
+
- WPF (System.Windows or System.Windows.Controls)
267
+
- WinForms (System.Windows.Forms)
268
+
- Avalonia (Avalonia)
269
+
- Uno (Windows.UI.Xaml).
270
+
271
+
```csharp
272
+
usingReactiveUI.SourceGenerators;
273
+
274
+
[IViewFor(MyReactiveClass)]
275
+
publicpartialclassMyReactiveControl : UserControl
276
+
{
277
+
publicMyReactiveControl()
278
+
{
279
+
InitializeComponent();
280
+
MyReactiveClass=newMyReactiveClass();
281
+
}
282
+
}
283
+
```
284
+
254
285
### TODO:
255
286
- Add ReactiveCommand with parameterised Attribute pass through
256
287
- Add ObservableAsProperty to generate from a IObservable creating a property and the property helper wired to the Observable.
0 commit comments