我想为XAML代码中的特定按钮制作一个Hexagon按钮。有人知道该怎么做吗?
答案 0 :(得分:0)
您可以使用Datatemplate更改按钮的外观,请检查以下代码:
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="305.661,0,180.661,87.258" Background="{x:Null}" BorderBrush="{x:Null}">
<Button.ContentTemplate>
<DataTemplate>
<Grid>
<Polygon Points="25,0 50,0 75,25 75,50 50,75 25,75 0,50 0,25" Stroke="Red" StrokeThickness="3" Fill="LightBlue"></Polygon>
<TextBlock Text="Test" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="36"></TextBlock>
</Grid>
</DataTemplate>
</Button.ContentTemplate>
</Button>