基于自己写的WpfButton,ButtonWithShape.xaml代码如下。

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiViews.MauiDemos.Book._06.ButtonWithShape"
             Title="ButtonWithShape" HeightRequest="150" WidthRequest="258">
    <WpfButton CornerRadius="15">
        <Grid>
            <Polygon Points="100,25 125,0 200,25 125,50"
                     Fill="LightSteelBlue" />
            <Polygon Points="100,25 75,0 0,25 75,50"
                     Fill="White"/>
        </Grid>
    </WpfButton>
</ContentPage>

运行效果

 

posted on 2025-07-03 09:00  dalgleish  阅读(16)  评论(0)    收藏  举报