ButtonWithShape.axaml代码

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Height="150" Width="258.8"
        x:Class="AvaloniaUI.ButtonWithShape"
        Title="ButtonWithShape">
    <Button Margin="10">
        <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>
    </Button>
</Window>

ButtonWithShape.axaml.cs代码

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace AvaloniaUI;

public partial class ButtonWithShape : Window
{
    public ButtonWithShape()
    {
        InitializeComponent();
    }
}

运行效果

 

posted on 2025-07-21 04:27  dalgleish  阅读(10)  评论(0)    收藏  举报