콘텐츠로 이동

ControlExtensions.Items method (1 of 14)

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

Sets ItemsSource to a view over the strings.

public static ComboBox Items(this ComboBox comboBox, params string[] items)
parameter description
comboBox Target combo box.
items Item strings.

The combo box for chaining.

Sets: ContextMenu.Items


Replaces the menu items.

public static ContextMenu Items(this ContextMenu menu, params MenuEntry[] items)
parameter description
menu Target context menu.
items Menu items.

The context menu for chaining.


Sets ItemsSource to a view over the strings.

public static ItemsControl Items(this ItemsControl itemsControl, params string[] items)
parameter description
itemsControl Target items control.
items Item strings.

The items control for chaining.


Sets ItemsSource to a view over the strings.

public static ListBox Items(this ListBox listBox, params string[] items)
parameter description
listBox Target list box.
items Item strings.

The list box for chaining.


ControlExtensions.Items<TSelf> method (5 of 14)

Section titled “ControlExtensions.Items<TSelf> method (5 of 14)”

Sets ItemsSource to a view over the strings, one segment each.

public static TSelf Items<TSelf>(this TSelf control, params string[] items)
where TSelf : SegmentedBase
parameter description
control Target segmented control.
items Segment labels.

The control for chaining.


ControlExtensions.Items<T> method (6 of 14)

Section titled “ControlExtensions.Items<T> method (6 of 14)”

Sets ItemsSource to a view over the items, with an optional text selector.

public static ItemsControl Items<T>(this ItemsControl itemsControl, IReadOnlyList<T> items,
Func<T, string>? textSelector = null)
parameter description
T Item type.
itemsControl Target items control.
items Items collection.
textSelector Optional text of an item; without one the item’s ToString() is used.

The items control for chaining.


ControlExtensions.Items<T> method (7 of 14)

Section titled “ControlExtensions.Items<T> method (7 of 14)”

Sets ItemsSource to a view over the items, with an optional text selector.

public static ComboBox Items<T>(this ComboBox comboBox, IReadOnlyList<T> items,
Func<T, string>? textSelector = null, Func<T, object?>? keySelector = null)
parameter description
T Item type.
comboBox Target combo box.
items Items collection.
textSelector Optional text of an item; without one the item’s ToString() is used.
keySelector Optional key selector to stabilize selection when items change.

The combo box for chaining.


ControlExtensions.Items<T> method (8 of 14)

Section titled “ControlExtensions.Items<T> method (8 of 14)”

Sets ItemsSource to a view over the items, with an optional text selector.

public static ListBox Items<T>(this ListBox listBox, IReadOnlyList<T> items,
Func<T, string>? textSelector = null, Func<T, object?>? keySelector = null)
parameter description
T Item type.
listBox Target list box.
items Items collection.
textSelector Optional text of an item; without one the item’s ToString() is used.
keySelector Optional key selector to stabilize selection when items change.

The list box for chaining.


ControlExtensions.Items<T> method (9 of 14)

Section titled “ControlExtensions.Items<T> method (9 of 14)”

Binds items using the default text template; without a text selector an item shows its ToString().

public static NavigationList Items<T>(this NavigationList control, IReadOnlyList<T> items,
Func<T, string>? textSelector = null, Func<T, NavigationItemKind>? kind = null,
Func<T, object?>? keySelector = null)

ControlExtensions.Items<T> method (10 of 14)

Section titled “ControlExtensions.Items<T> method (10 of 14)”

Sets ItemsSource and KindSelector from the items and the selectors, keeping the default text template; without a text selector an item shows its ToString().

public static NavigationList Items<T>(this NavigationList control, IReadOnlyList<T> items,
Func<TemplateContext, FrameworkElement> build,
Action<FrameworkElement, T, int, TemplateContext> bind,
Func<T, NavigationItemKind>? kind = null, Func<T, object?>? keySelector = null)

Generics are inferred once from items; kind and key are selectors, not chained generic calls.


ControlExtensions.Items<T> method (11 of 14)

Section titled “ControlExtensions.Items<T> method (11 of 14)”

Sets a hierarchical items source using a children selector.

public static TreeView Items<T>(this TreeView treeView, IReadOnlyList<T> roots,
Func<T, IReadOnlyList<T>> childrenSelector, Func<T, string>? textSelector = null,
Func<T, object?>? keySelector = null, Func<T, bool>? isExpandableSelector = null)
parameter description
treeView Target tree view.
roots Root items collection.
childrenSelector Selector for child collection.
textSelector Optional text selector for the default template.
keySelector Optional key selector for selection/state stability.
isExpandableSelector Optional selector that determines whether an item displays an expand indicator independently of its currently loaded child count.

The tree view for chaining.


ControlExtensions.Items<T> method (12 of 14)

Section titled “ControlExtensions.Items<T> method (12 of 14)”

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.

public static NavigationView Items<T>(this NavigationView view, 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)

ControlExtensions.Items<T> method (13 of 14)

Section titled “ControlExtensions.Items<T> method (13 of 14)”

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().

public static NavigationView Items<T>(this NavigationView view, 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)

ControlExtensions.Items<TSelf,T> method (14 of 14)

Section titled “ControlExtensions.Items<TSelf,T> method (14 of 14)”

Sets ItemsSource to a view over the items, one segment each, with an optional text selector.

public static TSelf Items<TSelf, T>(this TSelf control, IReadOnlyList<T> items,
Func<T, string>? textSelector = null, Func<T, object?>? keySelector = null)
where TSelf : SegmentedBase
parameter description
TSelf Control type.
T Item type.
control Target segmented control.
items Items collection.
textSelector Optional text of an item; without one the item’s ToString() is used.
keySelector Optional key selector to stabilize selection when items change.

The control for chaining.