Panel.Children Özellik

Tanım

UIElementCollection Bu Panelöğesinin alt öğelerini alır.

public:
 property System::Windows::Controls::UIElementCollection ^ Children { System::Windows::Controls::UIElementCollection ^ get(); };
public System.Windows.Controls.UIElementCollection Children { get; }
member this.Children : System.Windows.Controls.UIElementCollection
Public ReadOnly Property Children As UIElementCollection

Özellik Değeri

Bir UIElementCollection. Varsayılan değer boş UIElementCollectionbir değeridir.

Örnekler

Aşağıdaki kod örneği, bir öğeye alt Children öğe eklemek UIElement için özelliğinin Panel nasıl kullanılacağını gösterir.

StackPanel myStackPanel = new StackPanel();
Button myButton = new Button();
myButton.Content = "Press me";
myStackPanel.Children.Add(myButton);
Dim myStackPanel As New StackPanel()
Dim myButton As New Button()
myButton.Content = "Press me"
myStackPanel.Children.Add(myButton)

Açıklamalar

Children Bir Panel öğenin koleksiyonu yalnızca nesnelerden UIElement oluşabilir. Bir UIElement alt öğeye Panel örtük olarak öğesi için UIElementCollection eklerPanel.

Bu koleksiyonu türetilmiş Panel sınıflarla kullanmayın; bunun yerine koleksiyonu kullanın InternalChildren .

Bu özellik, veri bağlıysa null döndürürPanel.

Şunlara uygulanır

Ayrıca bkz.