<Style x:Key="RoundedButton" TargetType="Button">
<Setter Property="Width" Value="25"/>
<Setter Property="Height" Value="25"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Ellipse Name="GelBackground" StrokeThickness="1" Stroke="Black">
</Ellipse>
<ContentPresenter Name="GelButtonContent" VerticalAlignment="Center" HorizontalAlignment="Center"
Content="{TemplateBinding Content}"/>
</Grid>
</ControlTemplate>
<
WPF自定义一个圆形按钮Style
最新推荐文章于 2024-08-13 14:33:15 发布
本文介绍了如何在WPF中通过Style定义一个圆形按钮。关键在于利用Ellipse绘制圆形区域,将按钮形状改变。只需在Button中引用Style,即可实现圆形按钮效果。
摘要由CSDN通过智能技术生成