# .NET and More > WPF, WCF, WF >  Button Corner Radius XAML

## alexanderjames

Hi All

I'm very new to WPF and XAML, I'm building an application in VB.NET winforms and want to modernize the interface. I thought of using XAML, and read that I can add an ElementHost to my form and add in a XAML user control. I'm kind of getting the hang of editing gradients etc, the one thing I need to do is add a corner radius to my button and I cannot figure out how to do this, I have tried everything but nothing seems to work. Please can someone help me with this, or point me in the right direction. The code below is just for a button, please can someone help me with the corner radius.




```
<UserControl x:Class="UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:POSt.Net"
             mc:Ignorable="d" 
             d:DesignHeight="296.954" d:DesignWidth="303.046">
    <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Height="62" Margin="109,104,0,0" VerticalAlignment="Top" Width="74"/>


</UserControl>
```

Many thanks 
AJ

----------


## KGComputers

Here's a simple style that changes button corners to rounded. Just add it inside the UserControl.Resources XAML.



```
<UserControl.Resources>
<Style x:Key="ButtonRoundedCorner" TargetType="Button">
            <Setter Property="Background" Value="Silver"/>
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border CornerRadius="25" Background="{TemplateBinding Background}" BorderThickness="2">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">
                            </ContentPresenter>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</UserControl.Resources>
```

In your Button's Style attribute, simple reference the resource.



```
 <Button x:Name="button" Style="{StaticResource ButtonRoundedCorner}" ......>
```

- kgc

----------

