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

How can we properly fill the screen width with a Grid?

$
0
0

Based on this question, I'm actually confused as to how I can fill the screen width in a grid.

Basically I need two columns of equal width, and I need to place a label right in the middle of each cell.

This worked on v1.1.1

        <Grid IsVisible="{Binding IsNeutralVoice, Converter={StaticResource NotValueConverter}}" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <StackLayout Orientation="Horizontal" Grid.Row="0" Grid.Column="0" VerticalOptions="CenterAndExpand"
                         HorizontalOptions="CenterAndExpand">
                <ctrl:FontAwesomeLabel Text="&#xf028;" FontSize="50" TextColor="#FF69B4"
                                       Command="{Binding PlayAudioCommand}"
                                       CommandParameter="{Binding FileLocation}" />

            </StackLayout>
            <StackLayout Orientation="Horizontal" Grid.Row="0" Grid.Column="1" VerticalOptions="CenterAndExpand"
                         HorizontalOptions="CenterAndExpand">
                <ctrl:FontAwesomeLabel Text="&#xf028;" FontSize="50" TextColor="#0099CC"
                                       Command="{Binding PlayAudioCommand}"
                                       CommandParameter="{Binding AltFileLocation}" />
            </StackLayout>
        </Grid>

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>