To implement circular WPF Button use the following code.XAML: <Grid>
<Button Width="50" Height="50" Content="Click me!" Click="Button_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse Fill="Violet"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</Grid> Code:private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("I am circle button");
} Output:
Note: In order to make button as circle, you must set the height and width to equal values.
|