INavigationViewLocator interface

Namespace Runic.Navigation.Wpf in Runic.Navigation.Wpf 0.23.0

public interface INavigationViewLocator

Creates the view that presents a navigation entry's content.

Remarks

NavigationHost and NavigationDialogHost ask their own ViewLocator first, then an INavigationViewLocator from the region's RunicNavigator.Services, and finally fall back to the implicit DataTemplate keyed by the content's type.

Methods

ResolveView

FrameworkElement? ResolveView(NavigationEntry entry)

Returns a new view for this presentation of entry, or null to fall back. The host never asks twice for the same presentation, and sets the view's FrameworkElement.DataContext to the content unless the view set one itself. A view that NavigationHost.RetainViews keeps for a retained entry stays that entry's presentation, so the host doesn't ask again when the entry becomes current again.

Parameters

entry

The entry to present.

Returns

A new view, or null.

ResolveView

FrameworkElement? ResolveView(object content, IServiceProvider services)

Creates a new view for plain content in a ViewHost, without a navigation entry.

Remarks

The default returns null, so existing entry-specific locators fall back to implicit templates. ViewHost borrows content and never creates an entry, scope or retirement token.