如何在WPF应用程序中创建椭圆形按钮?

Awk*_*der 1 wpf button

正如主题,如何在 WPF 应用程序中创建椭圆形按钮?

And*_*rej 5

像这样的东西:

<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Ellipse Width="64" Height="32" Fill="Blue" />
<ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

我没有测试代码,但你应该明白:)

编辑:椭圆当然有填充属性而不是背景。

安德烈