Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-create-a-dockpanel.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

24 lines
1.0 KiB
Markdown

---
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 <xref:System.Windows.Controls.DockPanel> by using code. The example shows you how to partition space by creating five <xref:System.Windows.Shapes.Rectangle> elements and positioning (docking) them inside a parent <xref:System.Windows.Controls.DockPanel>. 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
- <xref:System.Windows.Controls.DockPanel>
- <xref:System.Windows.Controls.Dock>
- [Panels Overview](panels-overview.md)