Each control deriving from `Panel`

implements distinct layout logic performed in `Measure()`

and `Arrange()`

:

`Measure()`

determines the size of the panel and each of its children `Arrange()`

determines the rectangle where each control renders

The last child of the `DockPanel`

fills the remaining space. You can disable this behavior by setting the `LastChild`

property to `false`

.

The `StackPanel`

asks each child for its desired size and then stacks them. The stack panel calls `Measure()`

on each child, with an available size of `Infinity`

and then uses the child's desired size.

A `Grid`

occupies all available space, however, it will set each child to their desired size and then center them in the cell.

You can implement your own layout logic by deriving from `Panel`

and then overriding `MeasureOverride()`

and `ArrangeOverride()`

.

See this article for a simple example.