简体   繁体   中英

How to make Frame expand when the content expands in Xamarin forms

As per the title, i have a label inside a frame, both set to fill and expand and its inside a Grid, wanted to know if its possible to expand automatically when the content of the label text goes to the next line

<Frame Grid.Row="1" 
               VerticalOptions="FillAndExpand"
               HorizontalOptions="FillAndExpand"
               Margin="15,25,15,10"
               CornerRadius="25"
               Padding="10"
               HasShadow="False"
               BorderColor="Transparent"
               BackgroundColor="White">

            <Label x:Name="QuestionLabel" 
                   VerticalTextAlignment="Center" 
                   HorizontalTextAlignment="Start"
                   VerticalOptions="FillAndExpand"
                   HorizontalOptions="FillAndExpand"
                   LineBreakMode="WordWrap"
                   Style="{x:StaticResource LabelTitleBold}"
                   Text="{Binding Question}" 
                   TextColor="{x:StaticResource Primary}"/>
        </Frame>

This is what i've done, any inputs would be deeply appreciated

Thanks

What you need to do is try setting the height of Row in RowDefinition of the Grid to Auto. This might help.

<RowDefinition Height="auto" />

Let me know

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM