When building a .NET MAUI application, layouts help arrange UI elements such as labels, buttons, images, and entry controls on the screen. Choosing the right layout makes the UI clean, responsive, and easy to maintain.

In this article, we will look at the most commonly used layouts in .NET MAUI with simple examples.

1. VerticalStackLayout

VerticalStackLayout places controls one below another.

<VerticalStackLayout

Padding="20"

Spacing="10">

<Label Text="Name" />

<Entry Placeholder="Enter Name" />

<Label Text="Email" />

<Entry Placeholder="Enter Email" />

<Button Text="Submit" />

</VerticalStackLayout>

Output

2. HorizontalStackLayout

HorizontalStackLayout places controls side by side.

Output

Code Example

<HorizontalStackLayout

Padding="20"

Spacing="10">

<Label Text="Name" />

<Entry Placeholder="Enter Name" />

<Label Text="Email" />

<Entry Placeholder="Enter Email" />

<Button Text="Submit" />

</HorizontalStackLayout >

3. Grid Layout

Grid is one of the most powerful layouts in .NET MAUI. It organizes controls using rows and columns.

Code Example

<Grid Padding="20">

<Grid.RowDefinitions>

<RowDefinition Height="Auto" />

<RowDefinition Height="Auto" />

<RowDefinition Height="Auto" />

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition Width="120" />

<ColumnDefinition Width="*" />

</Grid.ColumnDefinitions>

<Label Text="Name:"

Grid.Row="0"

Grid.Column="0" />

<Entry Grid.Row="0"

Grid.Column="1" />

<Label Text="Email:"

Grid.Row="1"

Grid.Column="0" />

<Entry Grid.Row="1"

Grid.Column="1" />

<Button Text="Submit"

Grid.Row="2"

Grid.ColumnSpan="2" />

</Grid>

Output

4. FlexLayout

FlexLayout provides flexible positioning and wrapping of controls. You can fix multiple control. Example cc in mail. There you can keep number of names and UI keep expanding.

<FlexLayout

Direction="Row"

Wrap="Wrap"

JustifyContent="SpaceAround">

<Button Text="C#" />

<Button Text=".NET" />

<Button Text="MAUI" />

<Button Text="Azure" />

<Button Text="Angular" />

<Button Text="SQL" />

</FlexLayout>

Output

5. AbsoluteLayout

AbsoluteLayout positions controls using exact coordinates.

Code Example

<AbsoluteLayout HeightRequest="250">

<BoxView

Color="LightBlue"

AbsoluteLayout.LayoutBounds="0,0,1,1"

AbsoluteLayout.LayoutFlags="All" />

<Button

Text="Top Left"

AbsoluteLayout.LayoutBounds="20,20,-1,-1" />

<Button

Text="Bottom Right"

AbsoluteLayout.LayoutBounds="250,180,-1,-1" />

</AbsoluteLayout>

Output

Conclusion

Layouts are the foundation of every .NET MAUI user interface. VerticalStackLayout and HorizontalStackLayout are great for simple screens, Grid is perfect for structured layouts, FlexLayout offers responsive positioning, AbsoluteLayout provides precise control, and there is also more like ScrollView helps display large content.

In real-world applications, you will often combine multiple layouts to create clean and user-friendly screens.