콘텐츠로 이동

Items controls markup reference

이 콘텐츠는 아직 번역되지 않았습니다.

ItemsControl, ListBox, ComboBox, and navigation lists.

Receiver: NavigationView.

Method Sets Summary
CompactPaneWidth(double value) CompactPaneWidth Sets the pane width in the compact icon rail.
FooterItems(IReadOnlyList<T> items, Func<T, string> textSelector = null, Func<T, PathGeometry> icon = null, Func<T, Element> content = null, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Sets the footer list’s items, template and FooterContentSelector from the items and the selectors, with arbitrary Element icons; a returned instance cannot be shared by rows at the same time.
FooterItems(IReadOnlyList<T> items, Func<T, string> textSelector, Func<T, Element> icon, Func<T, Element> content = null, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Configures bottom-pinned footer items with arbitrary Element icons. A returned instance cannot be shared by rows at the same time.
IsPaneOpen(bool value = true) IsPaneOpen Sets whether the pane is expanded (an icon rail when inline, hidden when overlaid).
IsPaneToggleButtonVisible(bool value = true) IsPaneToggleButtonVisible Sets whether the toggle button is shown; hiding it pins the pane to its current state.
Items(IReadOnlyList<T> items, Func<T, string> textSelector = null, Func<T, PathGeometry> icon = null, Func<T, Element> content = null, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Sets the pane list’s items, template and ContentSelector from the items and the selectors, with optional PathGeometry icons; without a text selector an item’s label is its ToString().
Items(IReadOnlyList<T> items, Func<T, string> textSelector, Func<T, Element> icon, Func<T, Element> content = null, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Sets the pane list’s items, template and ContentSelector from the items and the selectors, with arbitrary Element icons; a returned instance cannot be shared by rows at the same time, and text is hidden when the pane is compact.
OnEffectivePaneDisplayModeChanged(Action handler) event EffectivePaneDisplayModeChanged Subscribes handler to EffectivePaneDisplayModeChanged. Occurs after EffectivePaneDisplayMode changes, once the layout pass that resolved it has finished, so a handler may invalidate layout without re-entering it.
OnSelectionChanged(Action<object> handler) event SelectionChanged Subscribes handler to SelectionChanged. Occurs when the selection changes.
PaneDisplayMode(PaneDisplayMode value) PaneDisplayMode Sets the requested pane placement; Auto resolves from the width.
PaneWidth(double value) PaneWidth Sets the expanded pane width.
SelectedIndex(int value) SelectedIndex Sets the selected item index (-1 = none).
WithContentSelector(Func<object, Element> value) ContentSelector Sets the selector mapping the selected item to its content element, which is cached per item.
WithFooterContentSelector(Func<object, Element> value) FooterContentSelector Sets the selector mapping a selected footer item to its content element.

Receiver: ScrollableItemsBase and derived types (where T : ScrollableItemsBase).

Method Sets Summary
OnScrollChanged(Action handler) event ScrollChanged Subscribes handler to ScrollChanged. Raised when the scroll offset, extent, or viewport changes.

Receiver: ItemsControl.

Method Sets Summary
ClearContainer(PrepareContainerHandler<ItemContainer, T> clear) Releases what PrepareContainer attached outside the template context, before the container takes another item.
FixedHeightPresenter() Uses fixed-height row virtualization with theme default item height.
FixedHeightPresenter(ItemsAnchor anchor) Uses fixed-height row virtualization anchored to the given viewport edge.
FixedHeightPresenter(double itemHeight) Uses fixed-height row virtualization with explicit item height.
FixedHeightPresenter(double itemHeight, ItemsAnchor anchor) Uses fixed-height row virtualization with explicit item height, anchored to the given viewport edge.
ItemHeight(double value) ItemHeight Sets the height of each item in DIPs; NaN uses the theme default.
ItemPadding(Thickness value) ItemPadding Sets the padding for each item.
ItemTemplate(Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, TItem, int, TemplateContext> bind, Action<FrameworkElement, TItem, int, TemplateContext> unbind = null) Sets the item template using delegate-based templating.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem, int, TemplateContext> bind, Action<TElement, TItem, int, TemplateContext> unbind = null) Sets the item template; the bind callback receives the root the build callback returned.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem> bind) Sets the item template from a root element and a bind callback that needs only the item.
ItemTemplate(IDataTemplate value) ItemTemplate Sets the item template; unset, a default label template is used.
Items(IReadOnlyList<T> items, Func<T, string> textSelector = null) Sets ItemsSource to a view over the items, with an optional text selector.
Items(params string[] items) Sets ItemsSource to a view over the strings.
ItemsSource(IItemsView itemsSource) ItemsSource Sets the items source.
PrepareContainer(PrepareContainerHandler<ItemContainer, T> prepare) Configures the container of each item once its content is bound. The container is the ItemContainer the items control places around every item.
StackPresenter() Uses non-virtualizing stack layout (all items realized).
StackPresenter(ItemsAnchor anchor) Uses non-virtualizing stack layout anchored to the given viewport edge.
VariableHeightPresenter() Uses variable-height virtualization (items are measured individually).
VariableHeightPresenter(ItemsAnchor anchor) Uses variable-height virtualization anchored to the given viewport edge.
WrapPresenter(double itemWidth, double itemHeight) Uses wrap-grid virtualization with fixed item size.

Receiver: ListBox and derived types (where T : ListBox).

Method Sets Summary
BindSelectedIndex(ObservableValue<TSource> source, Func<TSource, int> convert, Func<int, TSource> convertBack = null) bind SelectedIndex Binds the selected index to a converted observable value.
BindSelectedIndex(ObservableValue<int> source) bind SelectedIndex Binds the selected index to an observable value.
ClearContainer(PrepareContainerHandler<ItemContainer, T> clear) Releases what PrepareContainer attached outside the template context, before the container takes another item. Most hooks need no counterpart: context subscriptions and container properties are undone for you.
FixedHeightPresenter() Uses fixed-height row virtualization with theme default item height.
FixedHeightPresenter(double itemHeight) Uses fixed-height row virtualization with explicit item height.
HorizontalScroll(ScrollMode value) HorizontalScroll Sets the horizontal scroll mode, Auto by default, so items wider than the viewport scroll horizontally.
ItemHeight(double value) ItemHeight Sets the height of each list item.
ItemPadding(Thickness value) ItemPadding Sets the padding around each item’s text.
ItemTemplate(Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, TItem, int, TemplateContext> bind, Action<FrameworkElement, TItem, int, TemplateContext> unbind = null) Sets the item template using delegate-based templating.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem, int, TemplateContext> bind, Action<TElement, TItem, int, TemplateContext> unbind = null) Sets the item template; the bind callback receives the root the build callback returned.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem> bind) Sets the item template from a root element and a bind callback that needs only the item.
ItemTemplate(IDataTemplate template) ItemTemplate Sets the item template.
Items(IReadOnlyList<T> items, Func<T, string> textSelector = null, Func<T, object> keySelector = null) Sets ItemsSource to a view over the items, with an optional text selector.
Items(params string[] items) Sets ItemsSource to a view over the strings.
ItemsSource(ISelectableItemsView itemsSource) ItemsSource Sets the items source.
OnSelectedIndicesChanged(Action handler) event SelectedIndicesChanged Subscribes handler to SelectedIndicesChanged. Occurs when the set of selected items changes (multi-select).
OnSelectionChanged(Action<object> handler) event SelectionChanged Subscribes handler to SelectionChanged. Occurs when the selected item changes.
PrepareContainer(PrepareContainerHandler<ItemContainer, T> prepare) Configures the container of each item once its content is bound, so behavior can be attached to the whole item rather than to the template. The container is the ItemContainer the list box places around every item.
SelectedIndex(int value) SelectedIndex Sets the selected item index.
SelectedItem(object value) SelectedItem Sets the currently selected item object.
SelectionMode(ItemsSelectionMode value) SelectionMode Sets the selection mode; multi-selection needs an items source that supports it (e.g. created from a typed list), otherwise the mode stays Single.
StackPresenter() Uses non-virtualizing stack layout (all items realized).
VariableHeightPresenter() Uses variable-height virtualization (items are measured individually).
WrapPresenter(double itemWidth, double itemHeight) Uses wrap-grid virtualization with fixed item size.
ZebraStriping(bool value = true) ZebraStriping Sets whether alternating items use a second background color (zebra striping).

Receiver: NavigationList and derived types (where T : NavigationList).

Method Sets Summary
BindSelectedIndex(ObservableValue<int> source) bind SelectedIndex Binds the selected index to an observable value.
ClearContainer(PrepareContainerHandler<ItemContainer, T> clear) Releases what PrepareContainer attached outside the template context, before the container takes another item.
ItemHeight(double value) ItemHeight Sets the minimum height of selectable Item rows; headers and separators self-size, and NaN (the default) resolves from the theme.
ItemPadding(Thickness value) ItemPadding Sets the padding around each row’s content; the default comes from the theme.
ItemTemplate(Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, TItem, int, TemplateContext> bind, Action<FrameworkElement, TItem, int, TemplateContext> unbind = null) Sets the item template using delegate-based templating.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem, int, TemplateContext> bind, Action<TElement, TItem, int, TemplateContext> unbind = null) Sets the item template; the bind callback receives the root the build callback returned.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem> bind) Sets the item template from a root element and a bind callback that needs only the item.
ItemTemplate(IDataTemplate template) ItemTemplate Sets the item template.
Items(IReadOnlyList<T> items, Func<T, string> textSelector = null, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Binds items using the default text template; without a text selector an item shows its ToString().
Items(IReadOnlyList<T> items, Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, T, int, TemplateContext> bind, Func<T, NavigationItemKind> kind = null, Func<T, object> keySelector = null) Sets ItemsSource and KindSelector from the items and the selectors, keeping the default text template; without a text selector an item shows its ToString().
OnItemInvoked(Action<ItemInvokedEventArgs> handler) event ItemInvoked Subscribes handler to ItemInvoked. Occurs when a selectable row is activated by click or Enter, before a click selects it; a handler that sets Handled keeps the selection as it is.
OnSelectionChanged(Action<object> handler) event SelectionChanged Subscribes handler to SelectionChanged. Occurs when the selection changes.
PrepareContainer(PrepareContainerHandler<ItemContainer, T> prepare) Configures the container of each row once its content is bound, so behavior can be attached to the whole row rather than to the template.
SelectedIndex(int value) SelectedIndex Sets the selected row index, or -1 for none; non-item rows are rejected.
SelectedItem(object value) SelectedItem Sets the selected item object, or .
WithKindSelector(Func<object, NavigationItemKind> value) KindSelector Sets the per-item kind selector; null makes every row a selectable Item.

Receiver: ComboBox.

Method Sets Summary
BindSelectedIndex(ObservableValue<TSource> source, Func<TSource, int> convert, Func<int, TSource> convertBack = null) bind SelectedIndex Binds the selected index to a converted observable value.
BindSelectedIndex(ObservableValue<int> source) bind SelectedIndex Binds the selected index to an observable value.
ChangeOnWheel(bool value = true) ChangeOnWheel Sets whether the mouse wheel changes the selection to the previous or next item while the pointer is over the combo box.
ClearContainer(PrepareContainerHandler<ItemContainer, T> clear) Releases what PrepareContainer attached outside the template context, before the container takes another item.
ItemHeight(double value) ItemHeight Sets the height of items in the drop-down list.
ItemTemplate(Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, TItem, int, TemplateContext> bind, Action<FrameworkElement, TItem, int, TemplateContext> unbind = null) Sets the item template using delegate-based templating.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem, int, TemplateContext> bind, Action<TElement, TItem, int, TemplateContext> unbind = null) Sets the drop-down item template; the bind callback receives the root the build callback returned.
ItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem> bind) Sets the drop-down item template from a root element and a bind callback that needs only the item.
ItemTemplate(IDataTemplate template) ItemTemplate Sets the item template for the drop-down list.
Items(IReadOnlyList<T> items, Func<T, string> textSelector = null, Func<T, object> keySelector = null) Sets ItemsSource to a view over the items, with an optional text selector.
Items(params string[] items) Sets ItemsSource to a view over the strings.
ItemsSource(ISelectableItemsView itemsSource) ItemsSource Sets the items source.
OnSelectionChanged(Action<object> handler) event SelectionChanged Subscribes handler to SelectionChanged. Occurs when the selected item changes.
Placeholder(string value) Placeholder Sets the placeholder text shown when no item is selected.
PrepareContainer(PrepareContainerHandler<ItemContainer, T> prepare) Configures the container of each drop-down item once its content is bound, so behavior can be attached to the whole drop-down item rather than to the template.
SelectedIndex(int value) SelectedIndex Sets the selected item index.
SelectedItem(object value) SelectedItem Sets the currently selected item object.
SelectedItemTemplate(Func<TemplateContext, FrameworkElement> build, Action<FrameworkElement, TItem, int, TemplateContext> bind, Action<FrameworkElement, TItem, int, TemplateContext> unbind = null) Sets the selected item template using delegate-based templating.
SelectedItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem, int, TemplateContext> bind, Action<TElement, TItem, int, TemplateContext> unbind = null) Sets the header template for the selected item; the bind callback receives the root the build callback returned.
SelectedItemTemplate(Func<TemplateContext, TElement> build, Action<TElement, TItem> bind) Sets the header template for the selected item from a root element and a bind callback that needs only the item.
SelectedItemTemplate(IDataTemplate template) SelectedItemTemplate Sets the template that presents the selected item in the header. Without it the header falls back to the item template, then to the item text.
ZebraStriping(bool value = true) ZebraStriping Sets whether alternating drop-down items use a second background color (zebra striping).