Skip to content

RoutingState.CurrentViewModel property

Defined in

Type: RoutingState Namespace: ReactiveUI.Reactive Assembly: ReactiveUI.Reactive.dll

Applies to

net10.0, net10.0-ios26.0, net10.0-android36.0, net10.0-maccatalyst26.0, net10.0-macos26.0, net10.0-tvos26.0, net9.0, net8.0, net462, net481

Attributes: [IgnoreDataMember] [JsonIgnore]

public IObservable<IRoutableViewModel?> CurrentViewModel { get; protected set; }

View source

Summary: Gets an observable of the view model on top of the navigation stack. It emits the current view model when you subscribe, then again after every change to the stack. It emits null while the stack is empty.

Returns: IObservable

Examples

<![CDATA[
 using var subscription = screen.Router.CurrentViewModel
 .Subscribe(viewModel => Console.WriteLine(viewModel?.UrlPathSegment ?? "(nothing)"));
 ]]>