ItemsControl.ContainerFromElement 方法

定义

返回属于拥有给定容器元素的当前 ItemsControl 的容器。Returns the container that belongs to the current ItemsControl that owns the given container element.

重载

ContainerFromElement(DependencyObject)

返回属于拥有给定元素的当前 ItemsControl 的容器。Returns the container that belongs to the current ItemsControl that owns the given element.

ContainerFromElement(ItemsControl, DependencyObject)

返回属于拥有给定容器元素的指定 ItemsControl 的容器。Returns the container that belongs to the specified ItemsControl that owns the given container element.

ContainerFromElement(DependencyObject)

返回属于拥有给定元素的当前 ItemsControl 的容器。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

参数

element
DependencyObject

要为其返回容器的元素。The element to return the container for.

返回

属于拥有给定元素的当前 ItemsControl 的容器,或者,如果不存在这种容器,则为 nullThe container that belongs to the current ItemsControl that owns the given element or null if no such container exists.

另请参阅

ContainerFromElement(ItemsControl, DependencyObject)

返回属于拥有给定容器元素的指定 ItemsControl 的容器。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

参数

itemsControl
ItemsControl

要为其返回容器的 ItemsControlThe ItemsControl to return the container for.

element
DependencyObject

要为其返回容器的元素。The element to return the container for.

返回

如果 itemsControl 不为 null,则返回属于拥有给定元素的指定 ItemsControl 的容器。The container that belongs to the specified ItemsControl that owns the given element, if itemsControl is not null. 如果 itemsControlnull,则返回属于任何 ItemsControl 的最近容器。If itemsControl is null, returns the closest container that belongs to any ItemsControl.

另请参阅

适用于