RoutedViewHost class¶
Defined in
Namespace: Avalonia.ReactiveUI
Assembly: ReactiveUI.Avalonia.Autofac.dll
Full name: Avalonia.ReactiveUI.RoutedViewHost
Modifiers: public
Summary¶
This control hosts the View associated with ReactiveUI RoutingState,
and will display the View and wire up the ViewModel whenever a new
ViewModel is navigated to. Nested routing is also supported.
Applies to
netstandard2.0, netstandard2.0, netstandard2.0, netstandard2.0, netstandard2.0
Class hierarchy
classDiagram
class RoutedViewHost
class TransitioningContentControl
TransitioningContentControl <|-- RoutedViewHost
class IActivatableView {
<>
}
IActivatableView <|.. RoutedViewHost
class IEnableLogger {
<>
}
IEnableLogger <|.. RoutedViewHost
Inherits from: TransitioningContentControl
Implements: IActivatableView, IEnableLogger
Remarks¶
ReactiveUI routing consists of an IScreen that contains current RoutingState, several IRoutableViewModels, and a platform-specific XAML control called RoutedViewHost.
RoutingState manages the ViewModel navigation stack and allows ViewModels to navigate to other ViewModels. IScreen is the root of a navigation stack; despite the name, its views don't have to occupy the whole screen. RoutedViewHost monitors an instance of RoutingState, responding to any changes in the navigation stack by creating and embedding the appropriate view.
Place this control to a view containing your ViewModel that implements IScreen, and bind IScreen.Router property to RoutedViewHost.Router property.
<![CDATA[
<rxui:RoutedViewHost
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Router="{Binding Router}">
<rxui:RoutedViewHost.DefaultContent>
<TextBlock Text="Default Content"/>
</rxui:RoutedViewHost.DefaultContent>
</rxui:RoutedViewHost>
]]>
See [ ReactiveUI routing documentation website](https://reactiveui.net/docs/handbook/routing/) for more info.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [RoutedViewHost](# class. |
Properties¶
| Name | Summary |
|---|---|
| Router | Gets or sets the [RoutingState](# of the view model stack. |
| ViewContract | Gets or sets the view contract. |
| DefaultContent | Gets or sets the content displayed whenever there is no page currently routed. |
| ViewLocator | Gets or sets the ReactiveUI view locator used by this router. |
| StyleKeyOverride | Gets the type by which the element is styled. |
Fields¶
| Name | Summary |
|---|---|
| static RouterProperty | AvaloniaProperty for the [Router](# property. |
| static ViewContractProperty | AvaloniaProperty for the [ViewContract](# property. |
| static DefaultContentProperty | AvaloniaProperty for the [DefaultContent](# property. |