#1,054 – TabPanel Wraps and Evenly Spaces
April 18, 2014 1 Comment
Recall that a WrapPanel stacks controls horizontally until it fills the available space and then wraps to a new line. (Or stacks vertically and wraps to a new column, if the orientation is vertical).
The TabPanel, normally used to display the tabs in a TabControl, behaves a little like the WrapPanel. But when it decides to wrap to a new line, it evenly spaces the items within each line.
We can demonstrate this by starting with a wide window and then narrowing it to cause the items to wrap.
We can better visualize what’s going on here by changing the HorizontalAlignment of the Labels to Center so that they don’t stretch to fill the available space. We can then see the gaps introduced between elements by the TabPanel.
Notice that the TabPanel also attempts to place roughly the same number of items on each row.