Skip to content

ControlExtensions.PrepareContainer<T> method (1 of 8)

Configures each ButtonGroup segment container after its content is bound. Use it to assign Command, subscribe to Click, or configure IsCheckable / IsChecked (independent toggle), enabled state, or tooltip.

public static ButtonGroup PrepareContainer<T>(this ButtonGroup control,
Action<SegmentButton, T, int> prepare)

ControlExtensions.PrepareContainer<T> method (2 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (2 of 8)”

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.

public static ComboBox PrepareContainer<T>(this ComboBox comboBox,
PrepareContainerHandler<ItemContainer, T> prepare)
parameter description
T Item type.

The callback runs on every bind, which includes scrolling one back into view, so keep it cheap. Register event subscriptions through the supplied context and they are removed before the next item is bound; properties assigned directly are reset by the framework instead.


ControlExtensions.PrepareContainer<T> method (3 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (3 of 8)”

Configures each row once its cells are bound, so behavior can be attached to the whole row instead of being repeated in every cell template. The row is the container the grid already realizes, so no extra element is created.

public static GridView PrepareContainer<T>(this GridView grid,
PrepareContainerHandler<GridViewRow, T> prepare)
parameter description
T Item type.
grid Target grid view.
prepare Row configuration callback.

The grid view for chaining.

The callback runs on every bind, which includes scrolling a row back into view, so keep it cheap. Register event subscriptions through the supplied context and they are removed before the next item is bound; properties assigned directly are reset by the framework instead.


ControlExtensions.PrepareContainer<T> method (4 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (4 of 8)”

Configures the container of each item once its content is bound. The container is the ItemContainer the items control places around every item.

public static ItemsControl PrepareContainer<T>(this ItemsControl itemsControl,
PrepareContainerHandler<ItemContainer, T> prepare)
parameter description
T Item type.
itemsControl Target items control.
prepare Container configuration callback.

The items control for chaining.


ControlExtensions.PrepareContainer<T> method (5 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (5 of 8)”

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.

public static ListBox PrepareContainer<T>(this ListBox listBox,
PrepareContainerHandler<ItemContainer, T> prepare)
parameter description
T Item type.
listBox Target list box.
prepare Container configuration callback.

The list box for chaining.

The callback runs on every bind, which includes scrolling an item back into view, so keep it cheap. Register event subscriptions through the supplied context and they are removed before the next item is bound; properties assigned directly are reset by the framework instead.


ControlExtensions.PrepareContainer<T> method (6 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (6 of 8)”

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.

public static NavigationList PrepareContainer<T>(this NavigationList navigationList,
PrepareContainerHandler<ItemContainer, T> prepare)
parameter description
T Item type.

The callback runs on every bind, which includes scrolling one back into view, so keep it cheap. Register event subscriptions through the supplied context and they are removed before the next item is bound; properties assigned directly are reset by the framework instead.


ControlExtensions.PrepareContainer<T> method (7 of 8)

Section titled “ControlExtensions.PrepareContainer<T> method (7 of 8)”

Configures each segment container after its content is bound. The callback receives the container, the item, and its index; use it to set or bind any container property (enabled state, tooltip, etc.). Applied on every rebuild.

public static SegmentedControl PrepareContainer<T>(this SegmentedControl control,
Action<SegmentButton, T, int> prepare)
parameter description
T Item type.
control Target segmented control.
prepare Container configuration callback.

The control for chaining.


ControlExtensions.PrepareContainer<T> method (8 of 8)

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

Configures the container placed around each row once its content is bound, so behavior can be attached to the whole row, indent and expander included, instead of to the template.

public static TreeView PrepareContainer<T>(this TreeView treeView,
PrepareContainerHandler<ItemContainer, T> prepare)
parameter description
T Item type.
treeView Target tree view.
prepare Container configuration callback.

The tree view for chaining.

The callback runs on every bind, which includes scrolling a row back into view, so keep it cheap. Register event subscriptions through the supplied context and they are removed before the next item is bound; properties assigned directly are reset by the framework instead.