bordermauicornerradius

label text cropped with border with CornerRadius setted maui


when I set a CornerRadius in a Border the Label that is the Content of the Border is being cropped. This only happens when i run the program in windows, adroid works fine, ios I don't know.

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

Cropped Label Text in Border


Solution

  • This is actually a known issue with Maui at the moment, maybe you should use Frame for the moment until this is fixed

    More information about the issue can be found on this Github bug I raised a couple of days ago:

    https://github.com/dotnet/maui/issues/17753

    https://github.com/dotnet/maui/issues/17761

    https://github.com/dotnet/maui/issues/17763