Sizing the Rows and Columns

The hardcoded row heights and column widths in the Start screen example work for certain resolutions, but more work would need to be done to make the UI flexible enough to handle all possible resolutions. This could be done with code-behind that checks the current window size and adjusts values accordingly, but Grid exposes sophisticated sizing options that can sometimes make such code unnecessary.

Unlike FrameworkElement’s Height and Width properties, RowDefinition’s and ColumnDefinition’s corresponding properties do not default to autosized (Double.NaN). And unlike almost all other Height and Width properties, theirs are of type GridLength rather than double. This way, Grid can uniquely support three different types ...

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.