LogicalTreeHelper.GetChildren 方法

定義

藉由處理邏輯樹狀結構,傳回指定之物件的直接子物件集合。Returns the collection of immediate child objects of the specified object by processing the logical tree.

多載

GetChildren(DependencyObject)

透過處理邏輯樹狀,傳回所指定物件的立即子物件集合。Returns the collection of immediate child objects of the specified object, by processing the logical tree.

GetChildren(FrameworkContentElement)

藉由處理邏輯樹狀結構,傳回指定之 FrameworkContentElement 的直接子物件集合。Returns the collection of immediate child objects of the specified FrameworkContentElement by processing the logical tree.

GetChildren(FrameworkElement)

藉由處理邏輯樹狀結構,傳回指定之 FrameworkElement 的直接子物件集合。Returns the collection of immediate child objects of the specified FrameworkElement by processing the logical tree.

GetChildren(DependencyObject)

透過處理邏輯樹狀,傳回所指定物件的立即子物件集合。Returns the collection of immediate child objects of the specified object, by processing the logical tree.

public:
 static System::Collections::IEnumerable ^ GetChildren(System::Windows::DependencyObject ^ current);
public static System.Collections.IEnumerable GetChildren (System.Windows.DependencyObject current);
static member GetChildren : System.Windows.DependencyObject -> System.Collections.IEnumerable
Public Shared Function GetChildren (current As DependencyObject) As IEnumerable

參數

current
DependencyObject

要從中開始處理邏輯樹狀的物件。The object from which to start processing the logical tree. 這必須是 FrameworkElementFrameworkContentElementThis is expected to be either a FrameworkElement or FrameworkContentElement.

傳回

所指定物件之邏輯樹狀結構中的可列舉立即子物件集合。The enumerable collection of immediate child objects from the logical tree of the specified object.

備註

當您不確定current FrameworkElement是或FrameworkContentElement , 也不確定該物件的類別是否支援本身的內容模型集合時, 請使用此簽章和 helper 方法。Use this signature and helper method primarily when you are unsure whether current is a FrameworkElement or FrameworkContentElement and are also unsure whether that object's class supports its own content model collection. 如果您可以判斷所查詢物件的類型, 請檢查您知道存在於該類型上的特定內容屬性。If you can determine the type of the object you are querying, check the specific content property that you know exists on that type. 例如, 如果您知道所查詢的物件是ItemsControl, 請Items檢查屬性以取得具有集合介面支援的強型別集合, 而且可能比列舉值更有用。For example, if you know that the object you are querying is an ItemsControl, check the Items property to get a strongly typed collection, which has collection interface support and is probably more useful than an enumerator.

GetChildren(FrameworkContentElement)

藉由處理邏輯樹狀結構,傳回指定之 FrameworkContentElement 的直接子物件集合。Returns the collection of immediate child objects of the specified FrameworkContentElement by processing the logical tree.

public:
 static System::Collections::IEnumerable ^ GetChildren(System::Windows::FrameworkContentElement ^ current);
public static System.Collections.IEnumerable GetChildren (System.Windows.FrameworkContentElement current);
static member GetChildren : System.Windows.FrameworkContentElement -> System.Collections.IEnumerable
Public Shared Function GetChildren (current As FrameworkContentElement) As IEnumerable

參數

current
FrameworkContentElement

要從中開始處理邏輯樹狀的物件。The object from which to start processing the logical tree.

傳回

邏輯樹狀結構中,從 current 開始的直接子物件之可列舉的集合。The enumerable collection of immediate child objects starting from current in the logical tree.

GetChildren(FrameworkElement)

藉由處理邏輯樹狀結構,傳回指定之 FrameworkElement 的直接子物件集合。Returns the collection of immediate child objects of the specified FrameworkElement by processing the logical tree.

public:
 static System::Collections::IEnumerable ^ GetChildren(System::Windows::FrameworkElement ^ current);
public static System.Collections.IEnumerable GetChildren (System.Windows.FrameworkElement current);
static member GetChildren : System.Windows.FrameworkElement -> System.Collections.IEnumerable
Public Shared Function GetChildren (current As FrameworkElement) As IEnumerable

參數

current
FrameworkElement

要從中開始處理邏輯樹狀的物件。The object from which to start processing the logical tree.

傳回

邏輯樹狀結構中,從 current 開始的直接子物件之可列舉的集合。The enumerable collection of immediate child objects starting from current in the logical tree.

適用於