NavigationRouteMap class

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public sealed class NavigationRouteMap : INavigationRouteMap

Inherits or implements INavigationRouteMap.

The route map that NavigationRouteMapBuilder builds: typed route templates mapped to navigation targets.

Remarks

A template is segments separated by /: literals, compared without regard to case, and parameters {name} (a string), {name:int}, {name:long}, {name:guid} or {name:bool}. Parameter values are percent-encoded in a route path, and numbers use the invariant culture.

A route path matches the first route, in registration order, whose segments and parameter types match and whose content a region accepts. An entry's route is the route its target was created for by this map, or else the first route, in registration order, that describes the entry: by its content type and the input of its target, or by the values function of NavigationRouteMapBuilder.Map.

Properties

Templates

public IReadOnlyList<string> Templates { get; }

Gets the route templates, in registration order.

Methods

CreateTarget

public INavigationTarget<object>? CreateTarget(NavigationRegion region, string route)

Creates a target for route whose content region can present, or returns null when no route matches. Creating a target constructs no content.

Parameters

region

The region the target is for; its NavigationRegion.ContentType must accept the content.

route

A route path, with or without a leading /.

Documentation from INavigationRouteMap.CreateTarget.

GetRoute

public string? GetRoute(NavigationEntry entry)

Gets the route path of entry, or null when no route describes it.

Parameters

entry

An entry of a region of any navigator.

Documentation from INavigationRouteMap.GetRoute.

TryMatch

public bool TryMatch(string route, out string? canonical, out NavigationRouteValues? values)

Gets whether route matches one of the map's routes, and its canonical form: parameter values formatted again, literals as the template writes them, without a leading or trailing /.

Parameters

route

A route path.

canonical

The canonical route path.

values

The parameter values.