ViewForMixins class¶
Defined in
Namespace: ReactiveUI
Assembly: ReactiveUI.dll
Full name: ReactiveUI.ViewForMixins
Modifiers: public static
Summary¶
Provides extension methods for registering activation logic on views and view models that support activation. These
methods enable the execution of custom code when a view or view model is activated or deactivated, facilitating
resource management and lifecycle handling in reactive UI scenarios.
Applies to
net10.0, net10.0-android36.0, net10.0-ios26.0, net10.0-macos26.0, net10.0-windows10.0.19041, net10.0-tvos26.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net9.0, net9.0-tvos18.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-desktop1.0, net9.0-browserwasm1.0, net9.0-macos15.0, net9.0-ios18.0, net9.0-android35.0, net8.0, net8.0-macos14.5, net8.0-macos14.2, net8.0-maccatalyst17.5, net8.0-ios17.5, net8.0-tvos18.0, net8.0-macos15.0, net8.0-ios18.0, net8.0-windows10.0.19041, net8.0-maccatalyst18.0, net8.0-tvos17.2, netstandard2.1, net481, net462
Remarks¶
The methods in this class are typically used to register disposables or cleanup actions that should be tied to the activation lifecycle of a view or view model. This helps ensure that resources such as subscriptions are properly disposed of when the view is deactivated. Some methods accept an optional view parameter for advanced scenarios where the view and view model are not hosted together. Use these methods to simplify activation-aware resource management in MVVM architectures. Thread safety and correct disposal are managed internally. For unit testing purposes, the cache used to optimize activation fetcher lookups can be reset using the provided internal method; this should not be used in production code.
Methods¶
| Name | Summary |
|---|---|
| static WhenActivated | Registers a block of disposables to be created and disposed with the activation lifecycle of the specified view model. |
| static GetIsDesignMode | Gets a value indicating whether the view is currently being loaded by a designer surface. |