This documentation is archived and is not being maintained.

Panel Content Model Overview

This content model overview describes the supported content for a Panel. StackPanel and DockPanel are examples of Panel objects.

This topic contains the following sections.

A Panel has the following content properties.

The Children property can contain multiple objects, even other Panel objects. The following example shows how to use the Children property to add two Button objects to a StackPanel.

<Page  xmlns=""
    <Button>Button 1</Button>
    <Button>Button 2</Button>
using System;
using System.Windows;
using System.Windows.Controls;

namespace SDKSample
    public partial class StackpanelExample : Page
        public StackpanelExample()
            // Create two buttons
            Button myButton1 = new Button();
            myButton1.Content = "Button 1";
            Button myButton2 = new Button();
            myButton2.Content = "Button 2";

            // Create a StackPanel
            StackPanel myStackPanel = new StackPanel();

            // Add the buttons to the StackPanel

            this.Content = myStackPanel;