How to create/make rounded corner buttons in WPF?

xorpower picture xorpower · Jul 19, 2011 · Viewed 129.2k times · Source

I need to create a rounded corner glossy button in WPF. Can anyone please explain me what steps are needed?

Answer

Keith Stein picture Keith Stein · Aug 7, 2019

I know this post is super old, but I have an answer that's surprisingly missing from the above and is also much simpler than most.

<Button>
    <Button.Resources>
        <Style TargetType="Border">
            <Setter Property="CornerRadius" Value="5"/>
        </Style>
    </Button.Resources>
</Button>

Since the default ControlTemplate for the Button control uses a Border element, adding a style for Border to the Button's resources applies that style to that Border. This lets you add rounded corners without having to make your own ControlTemplate and without any code. It also works on all varieties of Button (e.g. ToggleButton and RepeatButton).