Dock​Panel Class

Definition

Defines an area where you can arrange child elements either horizontally or vertically, relative to each other.

public class DockPanel : System.Windows.Controls.Panel
Inheritance

Inherited Members

System.Object

System.Windows.Controls.Panel

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Remarks

A DockPanel contains a collection of UIElement objects, which are in the Children property.

The SetDock method changes the position of an element relative to other elements within the same container. Alignment properties, such as HorizontalAlignment, change the position of an element relative to its parent element.

If you set the LastChildFill property to true, which is the default setting, the last child element of a DockPanel always fills the remaining space, regardless of any other dock value that you set on the last child element. To dock a child element in another direction, you must set the LastChildFill property to false and must also specify an explicit dock direction for the last child element.

Panel elements do not receive focus by default. To compel a panel element to receive focus, set the Focusable property to true.

Note: The position of child elements of a DockPanel on the screen is determined by the Dock property of the respective child elements and the relative order of those child elements under the DockPanel. Therefore, a set of child elements with the same Dock property values can be positioned differently on the screen depending on the order of these children under the DockPanel. Child ordering effects positioning because the DockPanel iterates through its child elements in order, setting the position of each element depending on remaining space.

Constructors

Dock​Panel()

Initializes a new instance of the DockPanel class.

Fields

Dock​Property

Identifies the System.Windows.Controls.DockPanel.Dock attached property.

Last​Child​Fill​Property

Identifies the LastChildFill dependency property.

Properties

Last​Child​Fill

Gets or sets a value that indicates whether the last child element within a DockPanel stretches to fill the remaining available space.

Methods

Arrange​Override(​Size)

Arranges the content (child elements) of a DockPanel element.

Get​Dock(​UI​Element)

Gets the value of the System.Windows.Controls.DockPanel.Dock attached property for a specified UIElement.

Measure​Override(​Size)

Measures the child elements of a DockPanel prior to arranging them during the ArrangeOverride(Size) pass.

Set​Dock(​UI​Element, ​Dock)

Sets the value of the System.Windows.Controls.DockPanel.Dock attached property to a specified element.