Aspect Ratio

Keeps its content at a fixed width-to-height ratio.

Installation

bash
shellui-native add aspect-ratio

Platforms: MAUI · Avalonia.

Usage

Basic

Rendered with ShellUI for Blazor
16 : 9
<ui:AspectRatio Ratio="1.7778" WidthRequest="360">
    <Border StrokeThickness="0" StrokeShape="RoundRectangle 8" BackgroundColor="{DynamicResource ShellUIMuted}">
        <Label Text="16 : 9" HorizontalOptions="Center" VerticalOptions="Center" />
    </Border>
</ui:AspectRatio>
Avalonia, running in your browser

MAUI and Avalonia

  • On Avalonia AspectRatio is a Border, so CornerRadius rounds whatever is inside.
  • Set the width with WidthRequest on MAUI and Width on Avalonia.

API

Property Type Default Description
Ratio double 16 : 9 (1.7778) Width divided by height. 16:9 is 1.7778, 4:3 is 1.3333, a square is 1.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.