---
title: "DockPanel control in WPF"  
description: "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 positio"  
author: "Anonymous User"  
published: 2011-04-11  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/544/dockpanel-control-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# 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](https://www.mindstick.com/mindstickarticle/b4df45c8-5873-4a36-b953-4cb3409ba431/images/93280783-0309-4839-8038-28312fa71f00.png)

---

Original Source: https://www.mindstick.com/articles/544/dockpanel-control-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
