<Window x:Class="RFMatrix.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
xmlns:local="clr-namespace:RFMatrix"
mc:Ignorable="d"
Title="MainWindow" Height="433.125" Width="411.875">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Column="0" Grid.Row="0" Height="400" Width="400" HorizontalAlignment="Left" VerticalAlignment="Top" Content="Button" Template="{DynamicResource ButtonControlTemplate1}" Cursor="Hand">
<Button.Resources>
<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}">
<Grid>
<Ellipse x:Name="ButtonEllipse" Width="Auto" Height="Auto" StrokeThickness="4" Fill="White" Stroke="Gray"></Ellipse>
<Polygon x:Name="ButtonPolygon" Points="20,200 300,50 300,350" Stroke="White" StrokeThickness="2">
<Polygon.Fill>
<SolidColorBrush Color="Gray" Opacity="0.4"/>
</Polygon.Fill>
</Polygon>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonPolygon" Property="Fill" Value="Black"></Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonPolygon" Property="Fill" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Resources>
</Button>
</Grid>
</Window>
WPF圆形按钮
猜你喜欢
转载自blog.csdn.net/dxm809/article/details/107469119
今日推荐
周排行