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.

傳回

DependencyObject

擁有給定容器項目之目前 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
Public Shared Function ContainerFromElement (itemsControl As ItemsControl, element As DependencyObject) As DependencyObject

參數

itemsControl
ItemsControl

要為其傳回容器的 ItemsControlThe ItemsControl to return the container for.

element
DependencyObject

要為其傳回容器的項目。The element to return the container for.

傳回

DependencyObject

如果 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.

另請參閱

適用於