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>
上一篇:【WPF on .NET Core 3.0】 Stylet演示项目 - 简易图书管理系统(1)


下一篇:【WPF on .NET Core 3.0】 Stylet演示项目 - 简易图书管理系统(3) - 使用Conductor切换页面