liveBook · Manning

AbsoluteLayout

As explained in .NET MAUI in Action

AbsoluteLayout is a .NET MAUI layout that positions and sizes child views using explicit or proportional bounds within its available area.

AbsoluteLayout positions and sizes child views within its available area using explicit values, proportional values, or a combination of both. It is useful when a UI needs precise placement, but fixed coordinates can behave poorly across different screen sizes. section 6.3 section 6.5

Use two attached properties to control each child:

  • LayoutBounds is a Rect containing x, y, width, and height. The default is 0, 0, Auto, Auto, placing a child at the top left and sizing it to its content. section 6.3
  • LayoutFlags determines which bounds are proportional rather than absolute, including position, size, both, all values, or none. section 6.3
  • Prefer proportional positioning or sizing when the layout must adapt to different window dimensions. section 6.3

Floating action button

Wrap the page contents in an AbsoluteLayout, then add a 100-by-100 Button with a 50-pixel corner radius. Set LayoutFlags to PositionProportional and LayoutBounds to 0.9,0.9,100,100. The button stays near the lower-right area as the window changes size.

How .NET MAUI in Action covers it

How deep it goes
Explains LayoutBounds and LayoutFlags with defaults, proportional options, responsive behavior, and a working XAML example.
Examples
Uses BoxView comparisons and a floating action button positioned at proportional coordinates.
What it assumes
Assumes familiarity with basic .NET MAUI layouts and child views, while introducing AbsoluteLayout-specific properties from their defaults.
What you can do after
Build it from scratch by wrapping page content, configuring attached properties, and placing adaptive controls.
How it connects
Connects AbsoluteLayout with Grid, FlexLayout, BindableLayout, ScrollView, and RelativeLayout as alternative layout choices.

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.