当我在 Border 中设置 CornerRadius 时,作为 Border 内容的 Label 被裁剪。 只有当我在Windows中运行程序时才会发生这种情况,adroid工作正常,ios我不知道。
<Grid BindingContext="{TemplateBinding Content}">
<Border x:Name="foodTypeContainer"
MinimumWidthRequest="80"
MaximumHeightRequest="140"
Padding="8,0,8,0"
Stroke="Transparent"
BindingContext="{Binding .}">
<Border.StrokeShape>
<RoundRectangle CornerRadius="20" />
</Border.StrokeShape>
<Label x:Name="foodTypeTextLabel"
HorizontalOptions="Center"
VerticalOptions="Center">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding Name}" FontFamily="RubikLight"/>
</FormattedString>
</Label.FormattedText>
</Label>
</Border>
</Grid>
这实际上是 Maui 目前的一个已知问题,也许您应该暂时使用 Frame,直到此问题得到解决
有关该问题的更多信息可以在我几天前提出的这个 Github bug 上找到:
https://github.com/dotnet/maui/issues/17753