Skip to content

Panels markup reference

StackPanel, Grid, DockPanel, WrapPanel, UniformGrid, SplitPanel, and Canvas.

Receiver: Panel and derived types (where T : Panel).

Method Sets Summary
Children(params Element[] children) Add, AddRange Adds children to the panel.
ClipToBounds(bool value = true) ClipToBounds Sets whether children are clipped to the panel bounds.
Padding(Thickness value) Padding Sets the inner padding between the panel bounds and its children.
Padding(double horizontal, double vertical) Sets horizontal and vertical padding.
Padding(double left, double top, double right, double bottom) Sets padding for each side individually.
Padding(double uniform) Padding Sets uniform padding on all sides.

Receiver: DockPanel.

Method Sets Summary
LastChildFill(bool value = true) LastChildFill Sets whether the last child fills the remaining space instead of docking; the default is true.
Spacing(double value) Spacing Sets the spacing between children in DIPs.

Receiver: Grid and derived types (where T : Grid).

Method Sets Summary
AutoIndexing(bool value = true) AutoIndexing Sets whether children without an explicit row and column are placed in the first free cell; the default is true.
Columns(params GridLength[] columns) Defines columns for the grid.
Columns(string definition) Defines columns using string syntax: “Auto,,2,100”
Rows(params GridLength[] rows) Defines rows for the grid.
Rows(string definition) Defines rows using string syntax: “Auto,,2,100”
ShareStarSize(bool value = true) ShareStarSize Sets whether all star rows and all star columns take the measure size of the largest star track on their axis, scaled by weight.
ShowGridLine(bool value = true) ShowGridLine Sets whether lines are drawn between rows and columns, for layout debugging.
Spacing(double value) Spacing Sets the spacing between rows and between columns in DIPs.

Receiver: SplitPanel.

Method Sets Summary
First(UIElement value) First Sets the element shown in the first pane, or null for an empty pane.
FirstLength(GridLength value) FirstLength Sets the first pane length; a star value (the default) shares the remaining space with a star-sized second pane by weight.
Horizontal() Orientation = Horizontal Sets horizontal orientation.
MaxFirst(double value) MaxFirst Sets the maximum length of the first pane in DIPs; the default is no bound.
MaxSecond(double value) MaxSecond Sets the maximum length of the second pane in DIPs; the default is no bound.
MinFirst(double value) MinFirst Sets the minimum length of the first pane in DIPs.
MinSecond(double value) MinSecond Sets the minimum length of the second pane in DIPs.
Orientation(Orientation value) Orientation Sets the split direction; Horizontal (the default) places the panes left and right, Vertical top and bottom.
Second(UIElement value) Second Sets the element shown in the second pane, or null for an empty pane.
SecondLength(GridLength value) SecondLength Sets the second pane length; a star value (the default) shares the remaining space with a star-sized first pane by weight.
SplitterThickness(double value) SplitterThickness Sets the splitter thickness in DIPs; the default is 8.
Vertical() Orientation = Vertical Sets vertical orientation.

Receiver: StackPanel and derived types (where T : StackPanel).

Method Sets Summary
Horizontal() Orientation = Horizontal Sets horizontal orientation.
Orientation(Orientation value) Orientation Sets the axis along which children are stacked; the default is Vertical.
Spacing(double value) Spacing Sets the spacing between children in DIPs.
Vertical() Orientation = Vertical Sets vertical orientation.

Receiver: UniformGrid and derived types (where T : UniformGrid).

Method Sets Summary
Columns(int value) Columns Sets the number of columns; 0 (the default) derives it from the child count.
Rows(int value) Rows Sets the number of rows; 0 (the default) derives it from the child count.
Spacing(double value) Spacing Sets the spacing between cells in DIPs, for both row and column gaps.

Receiver: WrapPanel and derived types (where T : WrapPanel).

Method Sets Summary
Horizontal() Orientation = Horizontal Sets horizontal orientation.
ItemHeight(double value) ItemHeight Sets a fixed height for all items in DIPs; NaN (the default) sizes each item to its content.
ItemWidth(double value) ItemWidth Sets a fixed width for all items in DIPs; NaN (the default) sizes each item to its content.
Orientation(Orientation value) Orientation Sets the axis along which items flow before wrapping; the default is Horizontal.
Spacing(double value) Spacing Sets the spacing between items and between lines in DIPs.
Vertical() Orientation = Vertical Sets vertical orientation.