INavigationRegion interface

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

public interface INavigationRegion : INotifyPropertyChanged

Inherits or implements INotifyPropertyChanged.

The content-type-independent view of a NavigationRegion, for hosts that present a region without knowing its content type. Only NavigationRegion implements it.

Remarks

INotifyPropertyChanged.PropertyChanged is the region's event, with the same property names. The entry in a Committed returned by INavigationRegion.BackAsync, INavigationRegion.ClearAsync or INavigationRegion.ReplaceBorrowedAsync is a NavigationEntry of Object, a different instance from the typed entry in INavigationRegion.CurrentEntry and INavigationRegion.History. Compare entries by INavigationEntry.Id, not by reference.

Properties

CanGoBack

bool CanGoBack { get; }

Gets whether a retained entry exists to go back to.

ContentType

Type ContentType { get; }

Gets the region's content type.

Current

object? Current { get; }

Gets the current content, or null when the region is empty.

CurrentEntry

INavigationEntry? CurrentEntry { get; }

Gets the current entry, or null when the region is empty.

History

IReadOnlyList<INavigationEntry> History { get; }

Gets the retained entries below the current entry, from bottom to top.

IsTransitioning

bool IsTransitioning { get; }

Gets whether a transition of this region is in flight.

RunicNavigator Navigator { get; }

Gets the navigator that owns the region.

Methods

BackAsync

ValueTask<NavigationResult<object>> BackAsync(NavigationRequestOptions? options = null, CancellationToken cancellationToken = default)

Retires the current entry and resumes the top retained entry.

Remarks

Compare the result's entry with this region's entries by INavigationEntry.Id.

ClearAsync

ValueTask<NavigationResult<object>> ClearAsync(NavigationRequestOptions? options = null, CancellationToken cancellationToken = default)

Retires every entry. The region becomes empty.

Remarks

Compare the result's entry with this region's entries by INavigationEntry.Id.

ReplaceBorrowedAsync

ValueTask<NavigationResult<object>> ReplaceBorrowedAsync(object content, NavigationRequestOptions? options = null, CancellationToken cancellationToken = default)

Replaces the current entry with borrowed content. For presentation adapters that select existing models without knowing the region's generic content type.

Exceptions

ArgumentException

The content is not assignable to INavigationRegion.ContentType.

Remarks

The engine runs the same guards and lifetime rules as typed Replace. The caller retains ownership.