WPF圓角按鈕
阿新 • • 發佈:2018-12-11
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
<Border Name="buttonborder" BorderBrush="Green" BorderThickness="0" CornerRadius="15" Background="#3A98FC">
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="buttonborder" Property="Background" Value="#3A98FF"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="buttonborder" Property="Background" Value="Blue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
貢獻給大家 希望大家給我點個贊。
使用方法: <Button Foreground="White" Template="{StaticResource CornerButton}" />