Items view
An items view that lays out a collection, held whole, virtualized or windowed from a source.
Row choice is two-way through SelectionMode; SelectionStyle says what a chosen row looks like.
new ItemsViewComponent("items-view")
Properties
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
| Own | ||||
HostMode | UIItemsHostMode | UIItemsHostMode.Plain | — | How the host holds its rows. Set by Virtualized() or by binding a source, never directly. |
WindowSizeSetWindowSize | int | 50 | — | How many items one window holds; not bindable, the client reads it once. |
WindowOffset | int? | null | — | Where the realized window starts, as the source last reported it. This and the three below are bound by the compiler only; binding one by hand is refused. |
WindowTotalCount | int? | null | — | How many items the source holds, as it last reported. |
WindowHasMoreBefore | bool | false | — | Whether the source has items before the realized window. |
WindowHasMoreAfter | bool | false | — | Whether the source has items after the realized window. |
WindowAggregates | IReadOnlyDictionary<string, object> | null | — | What the source computed over every item the query leaves, by item property, as it last reported; bound by the compiler only. |
LayoutTypeSetLayoutType · BindLayoutType | UIItemsLayoutType? | UIItemsLayoutType.Stack | one-way | The layout algorithm used to arrange items. |
OrientationSetOrientation · BindOrientation | UIOrientation? | UIOrientation.Vertical | one-way | The orientation used to arrange items. |
SpacingSetSpacing · BindSpacing | UIResponsive<double>? | 0 | one-way | The spacing between items, optionally overridden per breakpoint. |
HorizontalScrollSetHorizontalScroll · BindHorizontalScroll | UIScrollMode? | UIScrollMode.Disabled | one-way | Whether the viewport scrolls horizontally — Disabled, Auto, or Always; default Disabled. |
VerticalScrollSetVerticalScroll · BindVerticalScroll | UIScrollMode? | UIScrollMode.Auto | one-way | Whether the viewport scrolls vertically — Disabled, Auto, or Always; default Auto. |
ScrollSnapSetScrollSnap · BindScrollSnap | UIScrollSnapMode? | UIScrollSnapMode.Disabled | one-way | Whether a scroll comes to rest on a child's edge rather than wherever it was let go. |
ScrollAnchorSetScrollAnchor · BindScrollAnchor | UIScrollAnchor? | UIScrollAnchor.None | one-way | How the viewport reacts when its content grows, applying to the component's own scrolling element so it also works for a windowed host that a wrapping ScrollContainer could not reach. |
SelectionModeSetSelectionMode · BindSelectionMode | UISelectionMode? | UISelectionMode.None | one-way | How many rows may be chosen at once. |
SelectedKeySetSelectedKey · BindSelectedKey | string | null | two-way | The key of the chosen row under UISelectionMode.One. |
SelectedKeysSetSelectedKeys · BindSelectedKeys | IReadOnlyList<string> | null | two-way | The keys of the chosen rows under UISelectionMode.Many, in the order they were chosen. |
SelectionStyleSetSelectionStyle · BindSelectionStyle | UISelectionStyle? | null | one-way | What a chosen item looks like. Unset, and every unset part of it, is the control's own default. |
RowHoverableSetRowHoverable · BindRowHoverable | bool? | false | one-way | Whether rows highlight under the pointer; off by default unless the host turns it on for itself. |
| From ItemsComponentBase | ||||
ItemsSetItems · BindItems | IReadOnlyList<object> | null | one-way | The component items. |
ItemsViewBindItemsView | UIItemsView | null | one-way | Filtering and sorting rules applied to the items collection. |
QuerySetQuery · BindQuery | UIItemsQuery | null | two-way | The terms the viewer set after the view compiled — a header's sort, a filter row — applied beside the authored rules; bound both ways, so a windowed source is asked with them and a controller can set them. |
| From TemplatedComponentBase | ||||
TemplateKeyPropertySetTemplateKeyProperty · BindTemplateKeyProperty | string | null | one-way, relative scope | The name of the item field whose value selects a named template variant. |
FallbackTemplateKeySetFallbackTemplateKey | string | null | — | The fallback template key used when ITemplatedComponent.TemplateKeyProperty does not resolve to a template. |
Events
OnItemClickWithItemKey(string command, string argumentName = "id")- Registers a click command invoked when an item is clicked, passing the item's key.
OnItemClickWithItem(string command, string argumentName = "item")- Registers a click command invoked when an item is clicked, passing the item.
OnItemClick(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a click command invoked when an item is clicked, with UI action arguments.
OnItemOpenWithItemKey(string command, string argumentName = "id")- Registers a command invoked when an item is opened — Enter on the keyboard's item, or a double click — with the item's key.
OnItemOpen(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a command invoked when an item is opened — Enter on the keyboard's item, or a double click.
OnItemRemoveWithItemKey(string command, string argumentName = "id")- Registers a command invoked when the Delete key is pressed on an item that may be removed, with the item's key.
OnItemRemove(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a command invoked when the Delete key is pressed on an item that may be removed; the controller removes it or leaves it.
Methods
Virtualized()- Keeps only the rows in view in the document, for a collection the client holds whole.
BindSource(string path, UIBindingScope scope = UIBindingScope.Root)- Binds the view's items to a windowed source on the controller.
The path names the source; the compiler appends the property holding its realized window. AnchorToEnd()- Follows content appended at the end while the viewer is already at the end.
ConfigureDefaultTemplate(Action<DefaultTextTemplate> configure)- Configures the built-in default text template, throwing if a different template has been set.
ConfigureDefaultEmptyTemplate(Action<DefaultEmptyTemplate> configure)- Configures the built-in default empty template, throwing if a different template has been set.
ConfigureDefaultGroupTemplate(Action<DefaultGroupTemplate> configure)- Configures the built-in default group template, throwing if a different template has been set.
DisableScroll()- Disables both horizontal and vertical scrolling.
VerticalScrollOnly()- Enables vertical scrolling only.
HorizontalScrollOnly()- Enables horizontal scrolling only.
BothScroll()- Enables both horizontal and vertical scrolling.
SetScroll(UIScrollMode horizontalScroll, UIScrollMode verticalScroll)- Sets the horizontal and vertical scroll behaviors.
SetGroupTemplate(IVisualComponent template)- Sets the template used to render item groups.
SetTemplate(IVisualComponent visualTemplate)- Sets the item template.
AddTemplateVariant(string key, IVisualComponent visualTemplate)- Adds or replaces a named template variant.
AddItem(object item)- Adds an item to the component.
AddItems(IEnumerable<object> items)- Adds items to the component.
FilterBy(UIProperty source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by a local component property.
Defaults to a case-insensitive substring match; pass the operator explicitly where case matters. FilterBy(string sourceComponentId, UIProperty source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by another component property.
FilterBy(UIPropertyReference source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by a property reference.
FilterBy(string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, object value = null)- Adds an unconditionally active filter with no source, comparing against a constant value.
SortBy(UIProperty source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by a local component property.
SortBy(string sourceComponentId, UIProperty source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by another component property.
SortBy(UIPropertyReference source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by a property reference.
SortBy(string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, int priority = 0)- Adds an unconditionally active sort rule with no source.
SetEmptyTemplate(IVisualComponent visualTemplate)- Sets the template used when there are no items or no content.
Common properties (16) — layout, visibility, theme, and the rest every component shares
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
VisibilitySetVisibility · BindVisibility | UIResponsive<UIVisibility>? | Visible | one-way | What the component does with the room it was given, optionally overridden per breakpoint (e.g. collapsed from a given width up). |
EnabledSetEnabled · BindEnabled | bool? | true | one-way | Whether the component responds to input; false dims it and marks it, and its subtree, inert. |
ThemeSetTheme · BindTheme | UIThemeMode? | null | one-way | The theme mode forced on this component's subtree, or null to inherit the ambient theme. |
HorizontalAlignmentSetHorizontalAlignment · BindHorizontalAlignment | UIAlignment? | UIAlignment.Stretch | one-way | Where the component sits within its grid cell along the horizontal axis. |
VerticalAlignmentSetVerticalAlignment · BindVerticalAlignment | UIAlignment? | UIAlignment.Stretch | one-way | Where the component sits within its grid cell along the vertical axis. |
WidthSetWidth · BindWidth | UIResponsive<UILayoutLength>? | null | one-way | The component width, optionally overridden per breakpoint. |
MinWidthSetMinWidth · BindMinWidth | UIResponsive<UILayoutLength>? | null | one-way | The component minimum width, optionally overridden per breakpoint. |
MaxWidthSetMaxWidth · BindMaxWidth | UIResponsive<UILayoutLength>? | null | one-way | The component maximum width, optionally overridden per breakpoint. |
HeightSetHeight · BindHeight | UIResponsive<UILayoutLength>? | null | one-way | The component height, optionally overridden per breakpoint. |
MinHeightSetMinHeight · BindMinHeight | UIResponsive<UILayoutLength>? | null | one-way | The component minimum height, optionally overridden per breakpoint. |
MaxHeightSetMaxHeight · BindMaxHeight | UIResponsive<UILayoutLength>? | null | one-way | The component maximum height, optionally overridden per breakpoint. |
ZIndexSetZIndex · BindZIndex | int? | 0 | one-way | The stacking order within the visual tree. |
MarginSetMargin · BindMargin | UIResponsive<UIThickness>? | null | one-way | The outer spacing around the component, optionally overridden per breakpoint. |
PlacementSetPlacement · BindPlacement | UIResponsive<UIGridPlacement>? | null | one-way | The grid placement, optionally overridden per breakpoint. |
LoadingSetLoading · BindLoading | bool? | false | one-way | Whether the component is in loading state — a live state a controller turns on and off. |
ShowContextMenuSetShowContextMenu · BindShowContextMenu | bool? | true | one-way | Whether a right-click opens the IVisualComponent.ContextMenu; on a host with rows, whether it opens any row's. Off, the menu stays in the tree and nothing opens it. |