How to create an oval button in the WPF application?

advertisements

Exactly as the subject, How to create oval button in WPF application?


Something like this:

<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>

I did not test the code, but you should get the idea :)

Edit: The Ellipse of course, has a Fill Property instead of Background.

Andrej