Skip to content

RoutedViewHost class

Defined in

Namespace: Avalonia.ReactiveUI Assembly: ReactiveUI.Avalonia.Autofac.dll Full name: Avalonia.ReactiveUI.RoutedViewHost Modifiers: public

Summary

View source

        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

NameSummary
.ctorInitializes a new instance of the [RoutedViewHost](# class.

Properties

NameSummary
RouterGets or sets the [RoutingState](# of the view model stack.
ViewContractGets or sets the view contract.
DefaultContentGets or sets the content displayed whenever there is no page currently routed.
ViewLocatorGets or sets the ReactiveUI view locator used by this router.
StyleKeyOverrideGets the type by which the element is styled.

Fields

NameSummary
static RouterPropertyAvaloniaProperty for the [Router](# property.
static ViewContractPropertyAvaloniaProperty for the [ViewContract](# property.
static DefaultContentPropertyAvaloniaProperty for the [DefaultContent](# property.
Inherited members