ItemsControl.ContainerFromElement Method

Definition

Returns the container that belongs to the current ItemsControl that owns the given container element.

Overloads

ContainerFromElement(DependencyObject)

Returns the container that belongs to the current ItemsControl that owns the given element.

ContainerFromElement(ItemsControl, DependencyObject)

Returns the container that belongs to the specified ItemsControl that owns the given container element.

ContainerFromElement(DependencyObject)

Returns the container that belongs to the current ItemsControl that owns the given element.

public:
 System::Windows::DependencyObject ^ ContainerFromElement(System::Windows::DependencyObject ^ element);
public System.Windows.DependencyObject ContainerFromElement (System.Windows.DependencyObject element);
member this.ContainerFromElement : System.Windows.DependencyObject -> System.Windows.DependencyObject
Public Function ContainerFromElement (element As DependencyObject) As DependencyObject

Parameters

element
DependencyObject

The element to return the container for.

Returns

The container that belongs to the current ItemsControl that owns the given element or null if no such container exists.

See also

Applies to

ContainerFromElement(ItemsControl, DependencyObject)

Returns the container that belongs to the specified ItemsControl that owns the given container element.

public:
 static System::Windows::DependencyObject ^ ContainerFromElement(System::Windows::Controls::ItemsControl ^ itemsControl, System::Windows::DependencyObject ^ element);
public static System.Windows.DependencyObject ContainerFromElement (System.Windows.Controls.ItemsControl itemsControl, System.Windows.DependencyObject element);
static member ContainerFromElement : System.Windows.Controls.ItemsControl * System.Windows.DependencyObject -> System.Windows.DependencyObject
Public Shared Function ContainerFromElement (itemsControl As ItemsControl, element As DependencyObject) As DependencyObject

Parameters

itemsControl
ItemsControl

The ItemsControl to return the container for.

element
DependencyObject

The element to return the container for.

Returns

The container that belongs to the specified ItemsControl that owns the given element, if itemsControl is not null. If itemsControl is null, returns the closest container that belongs to any ItemsControl.

See also

Applies to