--- title: "How to: Create a DockPanel" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "controls [WPF], DockPanel" - "DockPanel control [WPF], creating" ms.assetid: 9194f663-e279-4f1a-86d7-125a57d05c6f --- # How to: Create a DockPanel ## Example The following example creates and uses an instance of by using code. The example shows you how to partition space by creating five elements and positioning (docking) them inside a parent . If you retain the default setting, the final rectangle fills all the remaining unallocated space. [!code-csharp[DockPanelCode#1](~/samples/snippets/csharp/VS_Snippets_Wpf/DockPanelCode/CSharp/DockPanel_Code.cs#1)] [!code-vb[DockPanelCode#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/DockPanelCode/VisualBasic/dockpanel_vb.vb#1)] ## See also - - - [Panels Overview](panels-overview.md)