Home > DeveloperSection > Beginner > DockPanel control in WPF

DockPanel control in WPF


WPF WPF 
Ratings:
0 Comment(s)
 5888  View(s)
Rate this:

DockPanel control in WPF

In XAML <DockPanel /> element is used to create DockPanel control in WPF. DockPanel is used to dock child elements in left, right, top and bottom positions of relative item. The Dock side of an element is defined by the attached property DockPanel.Dock. In this demonstration we learn how to use DockPanel control in WPF.

A XAML code snippet representing DockPanel control

<DockPanel x:Name="dockPanel1">

        <Button x:Name="topButton" Content="Top Button" DockPanel.Dock="Top" />

        <Button x:Name="bottomButton" Content="Bottom Button" DockPanel.Dock="Bottom" />

        <Button x:Name="leftButton" Content="Left Button" DockPanel.Dock="Left" />

        <Button x:Name="rightButton" Content="Right Button" DockPanel.Dock="Right" />

        <Button x:Name="centerButton" Content="Center Button" />

</DockPanel>

Output of the following code snippet is as follows

DockPanel control in WPF

 


Don't want to miss updates? Please click the below button!

Follow MindStick