Silverlight Dock Panel is one of the Silverlight Panel that enables layout. DockPanel is used to arrange a set of objects around the edges of panel. Dock Panel’s Dock property enables you to specify the location of objects inside Dock Panel. If you set the LastChildFill property to true (the default value) and the last element is allowed to resize, the last element added to the panel will resize to fill the remaining space. If the last element is set to a specific size, the last element will be set to the specified size and positioned in the middle of the remaining space. The order in which elements are added to the DockPanel is important.


DockPanel Example

<Border BorderBrush="Black" BorderThickness="3" >
            <StackPanel x:Name="LayoutRoot" Background="White">
                <TextBlock Margin="5" Text="Dock Panel" />
                <Border BorderBrush="Black" BorderThickness="3" >
                    <controls:DockPanel LastChildFill="true" Height="265">
                        <Button  Content="Dock: Left" controls:DockPanel.Dock ="Left" />
                        <Button Content="Dock: Right" controls:DockPanel.Dock ="Right" />
                        <Button  Content="Dock: Top" controls:DockPanel.Dock ="Top" />
                        <Button  Content="Dock: Bottom" controls:DockPanel.Dock ="Bottom" />
                        <Button Content="Last Child" />

In Next we will discuss about Dock Panel Grid