Changing the look of a Button through a Template : Template « UI Controls « Silverlight






Changing the look of a Button through a Template

Changing the look of a Button through a Template
    
<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'>

    <Grid x:Name="LayoutRoot" Background="White">
        <Button x:Name="myButton" Content="Hello">
            <Button.Template>
                <ControlTemplate>
                    <Ellipse Height="90" Width="90" Stroke="Black" StrokeThickness="2">
                        <Ellipse.Fill>
                            <RadialGradientBrush GradientOrigin="0.3,0.2">
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.075" ScaleY="1.141"/>
                                            <SkewTransform CenterX="0.5" CenterY="0.5"/> 
                                            <RotateTransform CenterX="0.5" CenterY="0.5"/> 
                                            <TranslateTransform X="-0.04" Y="0.07"/> 
                                    </TransformGroup> 
                                </RadialGradientBrush.RelativeTransform> 
                                <GradientStop Color="Red" Offset="0.004"/> 
                                <GradientStop Color="#FF2103BA" Offset="1"/> 
                            </RadialGradientBrush> 
                        </Ellipse.Fill> 
                    </Ellipse> 
                </ControlTemplate> 
            </Button.Template>
        </Button>
    </Grid>
</UserControl>

   
    
    
    
  








Related examples in the same category

1.Template PartsTemplate Parts
2.Template States
3.Template BindingTemplate Binding