NavigationTarget class

Namespace Runic.Navigation · Runic.Navigation 0.7.0-preview.5

public static class NavigationTarget

Creates navigation targets and states who owns their content.

Methods

Borrow

public static INavigationTarget<T> Borrow<T>(T content) where T : class

Presents content owned by the caller or a container. The navigator never disposes or forgets it, and leaves the regions it owns alone.

Create

public static INavigationTarget<T> Create<T>(Func<IServiceProvider, T> factory) where T : class

Creates owned content when the transition prepares. The factory receives the window's service provider to resolve constructor dependencies, which stay container-owned; it must construct the content itself with new.

Create

public static INavigationTarget<T> Create<T, TInput>(Func<IServiceProvider, T> factory, TInput input) where T : class, INavigationInitialize<TInput>

Creates owned content like NavigationTarget.Create, then calls only INavigationInitialize.InitializeAsync with input.

Create

public static INavigationTarget<T> Create<T>() where T : class

Constructs owned content of type T when the transition prepares, with ActivatorUtilities.CreateInstance. Constructor parameters are resolved from the entry's service provider (INavigationEntry.Services) and stay container-owned. T itself is never resolved from the container. Mark a constructor with ActivatorUtilitiesConstructorAttribute to choose it.

Type parameters

T

The content type to construct.

Create

public static INavigationTarget<T> Create<T, TInput>(TInput input) where T : class, INavigationInitialize<TInput>

Constructs owned content like NavigationTarget.Create, then calls only INavigationInitialize.InitializeAsync with input.

Type parameters

T

The content type to construct.

TInput

The input type.

Parameters

input

The input passed to the content's initialize hook.

Own

public static INavigationTarget<T> Own<T>(T content) where T : class

Hands content constructed with new over to the navigator, which forgets and disposes it when its entry retires. An instance can be owned only once; content resolved from a container must be borrowed instead.