2

I have a grid with a label in it. The label has a text with a length larger than the width of the grid, hence it is wrapped. The grid however does not change its height based on the wrapped text, causing only the first line to be visible. I have set the grid rowheight to Auto.

Any other ideas?

EDIT: the code (a label in a grid)

<Grid RowSpacing="20">

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="1*"/>
        <ColumnDefinition Width="80*"/>
        <ColumnDefinition Width="1*"/>
    </Grid.ColumnDefinitions>

    <Label x:Name="This is a label which is wrapped" Grid.Row="0" Grid.Column="1" HorizontalOptions="CenterAndExpand" VerticalOptions="Start" FontSize="16"/>

</Grid>

EDIT: image result

enter image description here

Ganesh Gebhard
  • 453
  • 1
  • 7
  • 20

1 Answers1

1

I tested your code and it works, my workload is Android11, API30.

<Grid RowSpacing="20"> 
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="80*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
            
        <Label x:Name="label"
               Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
               Grid.Row="0"
               Grid.Column="1"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               FontSize="16"/>
    </Grid>