Item of Grid does not fit in cell

RedRaRedRa Member ✭✭
edited July 7 in Xamarin.Forms

Hi everyone,

I have faced with issue that Grid Item does not fit in cell:

<Grid
    VerticalOptions="FillAndExpand"
    x:Name="Grid"
    RowSpacing="15"
    ColumnSpacing="15">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="50" />
        <ColumnDefinition Width="50" />
        <ColumnDefinition Width="50" />
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition Height="100" />
        <RowDefinition Height="100" />
        <RowDefinition Height="100" />
    </Grid.RowDefinitions>

    <StackLayout
        VerticalOptions="FillAndExpand"
        HorizontalOptions="FillAndExpand"
        Grid.Row="0"
        Grid.Column="0">
        <Image
            WidthRequest="50"
            HeightRequest="50"
            Source="{utilsme:ImageResource MyApp.Forms.Resources.Images.my_image.png}"/>
        <Label
            Text="Home 0"
            HeightRequest="10"
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <!-- Other items -->
</Grid>

As result I have the following drawing:

Also I have found the following issue:

https://forums.xamarin.com/discussion/21532/grid-not-expanding-to-fit-content

But seems like over the years it still does not fixed ...

Guys, how to fix this behavior of the Grid ?

Answers

Sign In or Register to comment.