ViewModelViewHost class¶
Defined in
Namespace: ReactiveUI.Maui
Assembly: ReactiveUI.Maui.dll
Full name: ReactiveUI.Maui.ViewModelViewHost<T>
Modifiers: public
Summary¶
This content view will automatically load and host the view for the given view model. The view model whose view is to be displayed should be assigned to the ViewModel property. Optionally, the chosen view can be customized by specifying a contract via ViewContractObservable or ViewContract.
Applies to
net10.0, net10.0-android36.0, net10.0-ios26.0, net10.0-macos26.0, net10.0-windows10.0.19041, net10.0-browserwasm1.0, net10.0-desktop1.0, net10.0-tvos26.0, net10.0-maccatalyst26.0, net9.0, net9.0-tvos18.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-browserwasm1.0, net9.0-macos15.0, net9.0-ios18.0, net9.0-android35.0, net9.0-desktop1.0, net8.0-macos15.0, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-tvos18.0, netstandard2.1
Class hierarchy
classDiagram
class ViewModelViewHost~T~
class ContentView
ContentView <|-- ViewModelViewHost~T~
class IViewFor~TViewModel~ {
<>
}
IViewFor~TViewModel~ <|.. ViewModelViewHost~T~
class IViewFor {
<>
}
IViewFor <|.. ViewModelViewHost~T~
class IActivatableView {
<>
}
IActivatableView <|.. ViewModelViewHost~T~
Inherits from: ContentView
Implements: IViewFor
Remarks¶
This is the AOT-compatible generic version of ViewModelViewHost. It uses compile-time type information
to resolve views without reflection, making it safe for Native AOT and trimming scenarios.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [ViewModelViewHost](# class. |
Properties¶
| Name | Summary |
|---|---|
| ViewModel | Gets or sets the view model whose associated view is to be displayed. |
| DefaultContent | Gets or sets the content to display when [ViewModel](# is null. |
| ViewContractObservable | Gets or sets the observable which signals when the contract to use when resolving the view for the given view model has changed. |
| ViewContract | Gets or sets the fixed contract to use when resolving the view for the given view model. |
| ContractFallbackByPass | Gets or sets a value indicating whether should bypass the default contract fallback behavior. |
| ViewLocator | Gets or sets the override for the view locator to use when resolving the view. If unspecified, [Current](# will be used. |
Fields¶
| Name | Summary |
|---|---|
| static ViewModelProperty | Identifies the [ViewModel](# property. |
| static DefaultContentProperty | Identifies the [DefaultContent](# property. |
| static ViewContractObservableProperty | Identifies the [ViewContractObservable](# property. |
| static ContractFallbackByPassProperty | The ContractFallbackByPass dependency property. |
Methods¶
| Name | Summary |
|---|---|
| ResolveViewForViewModel | Resolves and displays the view for the given view model with respect to the contract. This method uses the generic ResolveView method which is AOT-compatible. |