VariableSizedWrapGrid and WrapPanel

VariableSizedWrapGrid is not as versatile as Grid, but it can do one trick that Grid cannot: wrap its elements when there’s not enough space. Although its name ends in “Grid,” VariableSizedWrapGrid is more like a StackPanel than a Grid. It stacks its children vertically (by default) or horizontally based on its Orientation property, and it doesn’t define any attached properties for placing items in specific rows or columns. The stack simply wraps into new rows/columns as needed. In fact, in WPF, this panel is called WrapPanel instead (although it has fewer features).

Figure 6.10 demonstrates how the following VariableSizedWrapGrid handles various layout conditions that can be inflicted by a user in the context ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.