What is Dock Panel

Dock panel is panel which allows you to arrange controls on left, right, top and bottom. At the time of control adding you have to set the property DockPanel.Dock either on left, right, top, and bottom.

Example of Dock Panel


		
	<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Tech Altum" Height="500" Width="700">

    <DockPanel>
        <Button DockPanel.Dock="Left" >Left Button</Button>
        <Button DockPanel.Dock="Bottom">Bottom Button</Button>
        <Button DockPanel.Dock="Right">Right Button</Button>
        <Button DockPanel.Dock="Top">Top Button</Button>
        <Button>Extra Space</Button>
    </DockPanel>
</Window>

The output of this example as follows:-


		
		dock panel in WPF

		Figure 1