ItemsControl.GetItemsOwner(DependencyObject) 方法

定義

傳回指定項目 (Element) 為其裝載項目 (Item) 的 ItemsControlReturns the ItemsControl that the specified element hosts items for.

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

參數

element
DependencyObject

裝載項目。The host element.

傳回

ItemsControl

指定項目 (Element) 為其裝載項目 (Item) 的 ItemsControl,或是 nullThe ItemsControl that the specified element hosts items for, or null.

備註

如果 IsItemsHost 樣式中的設為 true on,或為的所 element 建立的 element 面板,則 ItemsPresenter ItemsControl ItemsControl 會傳回,否則為 nullIf IsItemsHost is set to true on element in a style or if element is a panel created by the ItemsPresenter for an ItemsControl, the ItemsControl is returned; otherwise, null.

適用於