Back to results for “Grid”
.NET MAUI › XAML & UI Layouts

Compare StackLayout, VerticalStackLayout, and HorizontalStackLayout.

Beginner

Answer

VerticalStackLayout and HorizontalStackLayout are optimized single-orientation layouts introduced in MAUI; they are faster because they don't measure both orientations. StackLayout still exists with an Orientation property but is less performant. Prefer the dedicated layouts unless you need to switch orientation at runtime.
<VerticalStackLayout Spacing="10">
    <Label Text="Row 1" />
    <Label Text="Row 2" />
</VerticalStackLayout>
Real-world example Replacing StackLayout with VerticalStackLayout in a long form measurably reduces layout time during scrolling.

Common follow-ups: Why are the dedicated layouts faster? | When would you still use StackLayout?