DockPanel
The DockPanel control is a Panel which lays out its children by "docking" them to the sides or floating in the center.
1
<DockPanel Width="300" Height="300">
2
<Rectangle Fill="Red" Height="100" DockPanel.Dock="Top"/>
3
<Rectangle Fill="Blue" Width="100" DockPanel.Dock="Left"/>
4
<Rectangle Fill="Green" Height="100" DockPanel.Dock="Bottom"/>
5
<Rectangle Fill="Orange" Width="100" DockPanel.Dock="Right"/>
6
<Rectangle Fill="Gray" />
7
</DockPanel>
Copied!
The LastChildFill property means that the last child will fill any remaining space in the panel.
The DockPanel.Dock attached property is used to control which side an element is docked to. The options are Left, Top , Right and Bottom.

Reference

​DockPanel​

Source code

​DockPanel.cs​
Last modified 6mo ago
Export as PDF
Copy link