Wednesday, 9 May 2012

Button with Rounded Corners in WPF

First Created a Style


<Style x:Key="RoundButtonTemplate" TargetType="Button">
        <Setter Property="Background" Value="Brown"/>
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border CornerRadius="15" Background="{TemplateBinding Background}"
                                BorderThickness="1">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">

                        </ContentPresenter>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Call the style to Respective Button. 

<Button Focusable="False"
        Style="{StaticResource RoundButtonTemplate}"
        Width="264"
       Height="90" 
       Grid.Row="0"
       Margin="0,0,0,0"
       HorizontalAlignment="Center"
       BorderBrush="#FFF"
       Name="PasswordButton"
       Click="PasswordButton_Click"> 
                                             
</Button>
 

2 comments:

  1. Its really useful for my enhancement thank you

    ReplyDelete
  2. Guys i'm very new to this platform please anybody tell me clearly about this concept plssss

    Actualy i'm an Aeronautical Student so plsss light me up with a clear concept

    ReplyDelete