ItemsControl.ContainerFromElement 方法

定義

傳回擁有給定容器項目之目前 ItemsControl 所屬的容器。

多載

ContainerFromElement(DependencyObject)

傳回擁有給定項目之目前 ItemsControl 所屬的容器。

ContainerFromElement(ItemsControl, DependencyObject)

傳回擁有給定容器項目之指定 ItemsControl 所屬的容器。

ContainerFromElement(DependencyObject)

傳回擁有給定項目之目前 ItemsControl 所屬的容器。

C#
public System.Windows.DependencyObject ContainerFromElement (System.Windows.DependencyObject element);

參數

element
DependencyObject

要為其傳回容器的項目。

傳回

DependencyObject

擁有給定容器項目之目前 ItemsControl 所屬的容器,或是如果沒有這樣的容器存在則為 null

另請參閱

適用於

.NET Framework 4.8 和其他版本
產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

ContainerFromElement(ItemsControl, DependencyObject)

傳回擁有給定容器項目之指定 ItemsControl 所屬的容器。

C#
public static System.Windows.DependencyObject ContainerFromElement (System.Windows.Controls.ItemsControl itemsControl, System.Windows.DependencyObject element);

參數

itemsControl
ItemsControl

要為其傳回容器的 ItemsControl

element
DependencyObject

要為其傳回容器的項目。

傳回

DependencyObject

如果 itemsControl 不是 null,則為擁有給定項目之指定 ItemsControl 所屬的容器。 如果 itemsControlnull,則傳回任何 ItemsControl 所屬的最接近容器。

另請參閱

適用於

.NET Framework 4.8 和其他版本
產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7