WPF--->自定义Button圆形按钮Stylet
作者:互联网
<Style x:Key="CircularButton" TargetType="Button">
<Setter Property="Height" Value="20"/>
<Setter Property="Width" Value="20"/>
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="BorderBrush" Value="#b4b4b4"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse x:Name="ellipse" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"
Fill="{TemplateBinding Background}"
VerticalAlignment="Center" HorizontalAlignment="Center" IsHitTestVisible="True">
</Ellipse>
<Path Name="PART_ButtonPath" IsHitTestVisible="True" Fill="{TemplateBinding BorderBrush}" Data="M512 801.6896L5.12 282.0096l58.1632-59.5968L512 682.3936l448.7168-460.0832 58.1632 59.5968-506.88 519.7824z" Width="10" Height="10" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Uniform"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#2561a9"/>
<Setter Property="Background" Value="#ccdfeb"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
标签:BorderBrush,TemplateBinding,Center,自定义,Stylet,Button,Height,Width,59.5968 来源: https://blog.csdn.net/qq_42069216/article/details/112095303