What can a DockPanel do that a StackPanel cannot? If anyone has an image of something that can be achieved with a StackPanel, but not a DockPanel, than that would be great.
What can a DockPanel do that a StackPanel cannot? If anyone has an image
Share
Stack Panel: The
StackPanel, as the name implies, arranges content either horizontally or vertically. Vertical is the default, but this can be changed using theOrientationproperty. Content is automatically stretched based on the orientation (see screenshot below), and this can be controlled by changing theHorizontalAlignmentorVerticalAlignmentproperties.Dock Panel: The
DockPanelis used to anchor elements to the edges of the container, and is a good choice to set up the overall structure of the application UI. Elements are docked using theDockPanel.Dockattached property. The order that elements are docked determines the layout.