liveBook · Manning

Absolute sizing

As explained in .NET MAUI in Action

Absolute sizing assigns rows or columns fixed dimensions expressed in device-independent units.

Absolute sizing assigns rows or columns fixed dimensions in device-independent units (DIUs), making controls such as calculator buttons consistent in size across screen dimensions. section 5.1.3

Use absolute sizing to:

  • Specify each column’s width and each row’s height directly. section 5.1.3
  • Combine fixed button dimensions with proportional sizing for remaining screen space. section 5.1.3
  • Center a fixed-size Grid when a desktop window becomes wider than the design. section 5.1.3

MauiCalc button grid

Set ColumnDefinitions to "100,100,100,100" and RowDefinitions to "*,100,100,100,100". The screen row expands into remaining height while the four button rows and columns remain 100 DIUs, producing square buttons on phone and desktop. section 5.1.3

Listing 5.11 MauiCalc with fixed height and width buttons
<Grid ColumnDefinitions="100,100,100,100"  #1
RowDefinitions="*,100,100,100,100"   #2
 
HorizontalOptions="Center"           #3
 
      RowSpacing="2"
      ColumnSpacing="2">

Inspect the complete Grid definition for fixed-height and fixed-width MauiCalc buttons. section 5.1.3

How .NET MAUI in Action covers it

How deep it goes
Defines DIU-based dimensions, combines them with proportional rows, and stops short of broader visual styling.
Examples
Uses the MauiCalc calculator with 100-DIU button rows and columns, plus a flexible screen row.
What it assumes
Assumes familiarity with Grid rows, columns, and proportional sizing before introducing fixed DIU dimensions.
What you can do after
Apply it in a Grid to build consistently sized controls while preserving flexible space elsewhere.
How it connects
Connects absolute sizing with Grid, proportional sizing, and AbsoluteLayout positioning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.