RoutedViewHost class¶
Attributes: [DebuggerDisplay("{Router}, {ViewLocator}")]
Defined in
Namespace: ReactiveUI
Assembly: ReactiveUI.dll
Full name: ReactiveUI.RoutedViewHost
Modifiers: public
Summary¶
A ReactiveNavigationController that observes a RoutingState and mirrors its navigation stack into UIKit.
Applies to
net10.0-ios26.0, net10.0-maccatalyst26.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net481
Class hierarchy
classDiagram
class RoutedViewHost
class ReactiveNavigationController
ReactiveNavigationController <|-- RoutedViewHost
Inherits from: ReactiveNavigationController
Remarks¶
Use RoutedViewHost inside iOS or Mac Catalyst applications to keep push/pop transitions aligned with RoutingState changes. The host resolves views via ViewLocator and updates titles using UrlPathSegment so navigation remains consistent across app restarts.
Setting Router subscribes the host to Navigate, NavigateBack, and NavigationStackChanged. Manual calls to PushViewController and PopViewController also update the router so that imperative navigation cannot desynchronize the stacks.
Provide a ViewContractObservable when multiple views are registered for the same view model. The host will pass the latest contract to ViewLocator so that platform-specific or modal presentations render the correct view controller.
The host asks the view locator for each page's view by the view model's run-time type, without building any type
at run time, so it is safe to trim and to compile ahead of time. The default locator checks the view lookup the
source generator writes, then the views the app added with Map. A view registered only with the service
locator needs RoutedViewHostUnsafe.
Examples¶
<![CDATA[
var host = new RoutedViewHost
{
Router = shell.Router,
ViewLocator = locator,
ViewContractObservable = shell.WhenAnyValue(x => x.SelectedContract)
};
shell.Router.Navigate.Execute(new DashboardViewModel(shell)).Subscribe();
]]>
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [RoutedViewHost](# class. |
Properties¶
| Name | Summary |
|---|---|
| Router | Gets or sets the [RoutingState](# responsible for driving the navigation stack. Assigning a router wires the host up to all navigation observables. |
| ViewContractObservable | Gets or sets the observable contract used when resolving views. When null, the default contract is applied. |
| ViewLocator | Gets or sets the IViewLocator used to resolve view controllers for view models. |
Methods¶
| Name | Summary |
|---|---|
| PushViewController | |
| PopViewController | |
| Dispose | Releases the resources used by the NSObject object. |
Derived types¶
Inherited members
ReactiveUI.ReactiveNavigationController.#ctor(UIKit.UIViewController)ReactiveUI.ReactiveNavigationController.#ctor(System.Type,System.Type)ReactiveUI.ReactiveNavigationController.#ctor(System.String,Foundation.NSBundle)ReactiveUI.ReactiveNavigationController.#ctor(System.IntPtr@)ReactiveUI.ReactiveNavigationController.#ctor(Foundation.NSObjectFlag)ReactiveUI.ReactiveNavigationController.#ctor(Foundation.NSCoder)ReactiveUI.ReactiveNavigationController.#ctorReactiveUI.ReactiveNavigationController.SuppressChangeNotificationsReactiveUI.ReactiveNavigationController.ViewWillAppear(System.Boolean)ReactiveUI.ReactiveNavigationController.ViewDidDisappear(System.Boolean)ReactiveUI.ReactiveNavigationController.Dispose(System.Boolean)ReactiveUI.ReactiveNavigationController.ChangingReactiveUI.ReactiveNavigationController.ChangedReactiveUI.ReactiveNavigationController.ThrownExceptionsReactiveUI.ReactiveNavigationController.ActivatedReactiveUI.ReactiveNavigationController.DeactivatedReactiveUI.ReactiveNavigationController.PropertyChangingReactiveUI.ReactiveNavigationController.PropertyChangedSystem.Object.Equals(System.Object)System.Object.Equals(System.Object,System.Object)System.Object.GetHashCodeSystem.Object.GetTypeSystem.Object.MemberwiseCloneSystem.Object.ReferenceEquals(System.Object,System.Object)System.Object.ToString