Panel.Children Propriedade

Definição

Obtém um UIElementCollection conjunto de elementos filhos disto Panel.

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

Valor de Propriedade

Um UIElementCollection. O padrão é um vazio UIElementCollection.

Exemplos

O exemplo de código seguinte demonstra como usar a Children propriedade para adicionar um UIElement filho a um Panel elemento.

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)

Observações

A Children coleção de um Panel elemento só pode consistir em UIElement objetos. Adicionar um UIElement filho a um Panel implícitamente adiciona-o ao UIElementCollection para o Panel elemento.

Não use esta coleção com classes derivadas Panel ; use a InternalChildren coleção em vez disso.

Esta propriedade retorna null se o Panel for limitado pelos dados.

Aplica-se a

Ver também