Interface IActivatableViewModel
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
Implementing this interface on a ViewModel indicates that the ViewModel is interested in Activation events. Instantiate the Activator, then call WhenActivated on your class to register what you want to happen when the View is activated. See the documentation for ViewModelActivator to read more about Activation.
- Extension Methods
Examples
public sealed class DetailsViewModel : ReactiveObject, IActivatableViewModel
{
public DetailsViewModel()
{
Activator = new ViewModelActivator();
this.WhenActivated(disposables =>
{
LoadCommand.Execute().Subscribe().DisposeWith(disposables);
});
}
public ViewModelActivator Activator { get; }
}
Remarks
Typical usage involves creating a ViewWhenActivated
in the constructor to compose subscriptions that should live only while the view is displayed.
Properties
Activator
Gets the Activator which will be used by the View when Activation/Deactivation occurs.