Syntax for Border CorneRradius in Global Style

Sam Basile 21 Reputation points
2022-06-07T19:51:38.397+00:00

What is the proper way to set a .NET Maui Border StrokeShape of RoundRectangle with a CornerRadius of 2,2,2,2 in a Global styles resource XAML?

Thanks.

Developer technologies .NET .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-06-08T08:09:51.313+00:00

    Hello,​

    I create a <Style x:Key="MyBorderStyle" TargetType="Border">, set <Setter Property="StrokeShape" Value="RoundRectangle 2,2,2,2"/>
    in the Styles.xaml and set Style="{StaticResource MyBorderStyle}" in the Border‘s Style. But this Border will disappear when I debug it in emulator. If I change some property then hot reload executed, Border appears.

    This issue is filed in the Maui GitHub Page: https://github.com/dotnet/maui/issues/7744 You have left a comment, please waitting for PG’s update.

    Before this issue fixed, you can use <Frame> to replace of <Border>, and I create a global style in the Styles.xaml and set <Setter Property="CornerRadius" Value="2"/>, it worked as normal.
    https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/frame

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.