Each control deriving from
Panel implements distinct layout logic performed in
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
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.
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
See this article for a simple example.