Button with style : Styles « Graphics « Silverlight






Button with style

Button with style
   
<UserControl x:Class='SilverlightApplication3.MainPage'
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>
  <UserControl.Resources>    
    <Style x:Key="BigButtonStyle" TargetType="Button">    
      <Setter Property="Padding" Value="20" />
      <Setter Property="Margin" Value="10" />
      <Setter Property="FontFamily" Value="Georgia" />
      <Setter Property="FontSize" Value="40" />
      <Setter Property="Foreground" Value="SlateGray" />
      <Setter Property="Background">
        <Setter.Value>
          <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="Blue"></GradientStop>
            <GradientStop Color="Yellow" Offset="1"></GradientStop>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </Style>
  </UserControl.Resources>

  <StackPanel x:Name="LayoutRoot" Background="White">
    <Button Style="{StaticResource BigButtonStyle}" 
  Content="A Customized Button"></Button>
<Button Style="{StaticResource BigButtonStyle}" 
  Content="Another Customized Button"></Button>
  </StackPanel>
</UserControl>

   
    
    
  








Related examples in the same category

1.Styles And TemplatesStyles And Templates