Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Xaml OnPlatform to specify width for ColumnDefinition

$
0
0

Is it possible to set a column definition depending on the device type (phone or tablet)?

I tried "<OnIdiom x:TypeArguments=" but my code seems to be invalid.

 <Grid
        BackgroundColor="Aqua"
        RowSpacing="0"
        ColumnSpacing="0">

        <Grid.RowDefinitions>
            <RowDefinition Height="80" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <!-- Custom definition per device type -->
            <ColumnDefinitions.ColumnDefinition>
                <OnIdiom x:TypeArguments="Width">
                    <OnIdiom.Phone>"*"</OnIdiom.Phone>
                    <OnIdiom.Tablet>"500"</OnIdiom.Tablet>
                </OnIdiom>
            </ColumnDefinitions.ColumnDefinition>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
</Grid>

Viewing all articles
Browse latest Browse all 58056

Trending Articles