RunicRegionCollectionAttribute class

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public sealed class RunicRegionCollectionAttribute : Attribute

Inherits or implements Attribute.

Presents a get-only NavigationSelection property as a region collection (Views protocol 4, feature region-collections/1): every region of the selection, in order, with a stable key and its current content, and the selected index. The web view selects and closes regions by key; regions are added by the ViewModel, with NavigationSelection.Add.

Parameters

contentType

The interface or base class of the ViewModels that the regions present, as TContent of a NavigationRegion<TContent> slot. It must not be Object.

Remarks

Without this attribute, a NavigationSelection property is a selection slot whose wire value is its SelectedIndex, and each region is a slot of its own. With it, the property's TypeScript type is RegionCollection<R>, { regions: readonly { key: string; content: R | null }[]; selected: number | null }, where R is the union of the page references of the ViewModels that are a RunicRegionCollectionAttribute.ContentType.

The generated client gets select{Name}(key) and, unless RunicRegionCollectionAttribute.PageCanClose is false, close{Name}(key). They call NavigationSelection.SelectAsync and NavigationSelection.RemoveAsync, so the departure guards of the region left or closed decide, and they resolve with the request's NavigationOutcome.

Constructors

RunicRegionCollectionAttribute

public RunicRegionCollectionAttribute(Type contentType)

Presents a get-only NavigationSelection property as a region collection (Views protocol 4, feature region-collections/1): every region of the selection, in order, with a stable key and its current content, and the selected index. The web view selects and closes regions by key; regions are added by the ViewModel, with NavigationSelection.Add.

Parameters

contentType

The interface or base class of the ViewModels that the regions present, as TContent of a NavigationRegion<TContent> slot. It must not be Object.

Remarks

Without this attribute, a NavigationSelection property is a selection slot whose wire value is its SelectedIndex, and each region is a slot of its own. With it, the property's TypeScript type is RegionCollection<R>, { regions: readonly { key: string; content: R | null }[]; selected: number | null }, where R is the union of the page references of the ViewModels that are a RunicRegionCollectionAttribute.ContentType.

The generated client gets select{Name}(key) and, unless RunicRegionCollectionAttribute.PageCanClose is false, close{Name}(key). They call NavigationSelection.SelectAsync and NavigationSelection.RemoveAsync, so the departure guards of the region left or closed decide, and they resolve with the request's NavigationOutcome.

Properties

ContentType

public Type ContentType { get; }

The interface or base class of the ViewModels that the regions present.

PageCanClose

public bool PageCanClose { get; set; }

Whether the web view can close a region, which removes it from the selection after its departure guards agreed; true by default. Set it to false for tabs that only the ViewModel closes.