Avalonia.ReactiveUIpackage, such as
ReactiveUserControl<TViewModel>. Of course, you can also implement the
IViewFor<TViewModel>interface by hand in your class, but make sure you store the
IActivatableViewModelinterface. When the corresponding view gets attached to the visual tree, the code inside the WhenActivated block will get called. When the corresponding view gets detached from the visual tree, the composite disposable will be disposed.
ReactiveObjectis the base class for view model classes, and it implements
View.xamlfile you see above. Remember to always put a call to
WhenActivatedinto your View constructor, otherwise ReactiveUI won't be able to determine when the view model gets activated.
x:Namereferences to controls. The only way to use code-behind ReactiveUI bindings for now is to use the
FindControlmethod that will find a control by the name specified in XAML, or to use
FindControlmethod shouldn't be used inside an expression. Instead, create a custom property which calls the
FindControlmethod, or store the control in a variable. See the example below illustrating how to use ReactiveUI code-behind bindings with Avalonia.