Round Button in WPF

Introduction

This blog illustrates to create round button in WPF, follow the below XAML code to create rounded button.
 
  1. <Button Width="100" Content="Round Button"  
  2.       Height="100">  
  3.           <Button.Template>  
  4.               <ControlTemplate TargetType="Button">  
  5.                   <Grid>  
  6.                       <Ellipse Stroke="Black"  
  7.                        StrokeThickness="0">  
  8.                           <Ellipse.Fill>  
  9.                               <RadialGradientBrush>  
  10.                                   <GradientStop Offset="0"  
  11.                                         Color="Gray" />  
  12.                                   <GradientStop Offset="1"  
  13.                                         Color="Gray" />  
  14.                                   <GradientStop Offset="1"  
  15.                                         Color="DarkGray" />  
  16.                                   <RadialGradientBrush.Transform>  
  17.                                       <TransformGroup>  
  18.                                           <ScaleTransform ScaleY="0.65" />  
  19.                                       </TransformGroup>  
  20.                                   </RadialGradientBrush.Transform>  
  21.                               </RadialGradientBrush>  
  22.                           </Ellipse.Fill>  
  23.                       </Ellipse>  
  24.                       <ContentPresenter HorizontalAlignment="Center"  
  25.                                 VerticalAlignment="Center"/>  
  26.                   </Grid>  
  27.               </ControlTemplate>  
  28.           </Button.Template>  
  29.       </Button>  

 
Image
 
Ebook Download
View all
Learn
View all