如何使标签占据整个框架元素 space

How to make a label to take entire Frame element space

我有一个以框架元素作为单元格的网格。在一些框架元素中,有标签元素。问题是标签的延伸程度与其内容一样多。

我的目标是让标签占据其父元素(框架)的整个 space。 我尝试将 VerticalOptions 和 Horizo​​ntalOptions 属性设置为“StartAndExpand”,也尝试将“FillAndExpand”设置为无济于事

<Grid>
    <Frame Grid.Row="0" Grid.Column="0">
            <Label Text="Hello" />
    </Frame>
 ...
</Grid>

谢谢!

编辑:澄清一下,我想拉伸标签本身而不是它的文本。

由于Frame有一个默认值padding,只需像下面这样手动设置即可。

<Frame padding="0">
    <....>
</Frame>

此外,有时带有长文本的标签在 Frame
中表现不正确 一种解决方法是用 StackLayout.

包装标签