NavigationSelectionPath record

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public sealed record NavigationSelectionPath : IEquatable<NavigationSelectionPath>

Inherits or implements IEquatable.

A selection of a NavigationPath, such as document tabs: each region of it by position, and the selected one. Restoring it creates regions beyond the selection's current ones with NavigationSelectionOptions.RestoreRegion.

Parameters

Regions

The selection's regions, in presentation order.

SelectedIndex

The index of the selected region, or -1 when the selection was empty. The JSON property is selected.

Constructors

NavigationSelectionPath

public NavigationSelectionPath(IReadOnlyList<NavigationRegionPath> Regions, int SelectedIndex)

A selection of a NavigationPath, such as document tabs: each region of it by position, and the selected one. Restoring it creates regions beyond the selection's current ones with NavigationSelectionOptions.RestoreRegion.

Parameters

Regions

The selection's regions, in presentation order.

SelectedIndex

The index of the selected region, or -1 when the selection was empty. The JSON property is selected.

Properties

Regions

public IReadOnlyList<NavigationRegionPath> Regions { get; init; }

The selection's regions, in presentation order.

SelectedIndex

public int SelectedIndex { get; init; }

The index of the selected region, or -1 when the selection was empty. The JSON property is selected.

Methods

FromJson

public static NavigationSelectionPath FromJson(string json)

Reads a selection that NavigationSelectionPath.ToJson wrote. Unknown properties are ignored.

Exceptions

FormatException

The text is not one navigation selection, has a newer version, or exceeds the bounds of NavigationPath.FromJson.

ToJson

public string ToJson()

Writes the selection as JSON, as an element of selections in NavigationPath.ToJson: {"version":1,"regions":[],"selections":[{"selected":0,"regions":[{"entries":[…]}]}]}.

Remarks

Use it to store one selection, such as a tab strip, without the rest of the navigator; restore it with NavigationSelection.RestoreAsync.