首页 > 解决方案 > Xamarin表单中内容扩展时如何使Frame扩展

问题描述

根据标题,我在框架内有一个标签,既设置为填充和扩展,也设置为在网格内,想知道当标签文本的内容进入下一行时是否可以自动扩展

<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>

这就是我所做的,任何输入将不胜感激

谢谢

标签: c#xamarin.forms

解决方案


您需要做的是尝试将 Grid 的 RowDefinition 中的 Row 高度设置为 Auto。这可能会有所帮助。

<RowDefinition Height="auto" />

让我知道


推荐阅读