How to create a button where the corner is not round in WPF

I am try to create a button with sharp corner rather than rounded corner in WPF. Is there anyway to do it.
Who is Participating?
You need to modify the template of the button and set the CornerRadius property of the Border of the button to zero.

For example,
To create a button with black border and gray background and a sharp corner, the xaml is given below:
<Window x:Class="WpfApplication1.Window1"
    Title="Window1" Height="300" Width="300">
        <ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type Button}">
            <Border SnapsToDevicePixels="True" BorderBrush="Black" BorderThickness="1" CornerRadius="0" Background="Gray" TextBlock.Foreground="Black">
                <ContentPresenter RecognizesAccessKey="True"></ContentPresenter>
        <Button Width="100" Height="30" Template="{StaticResource ButtonTemplate}"></Button>

Open in new window

xewooxAuthor Commented:
Does this work with RepeatButton too?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.