/ Published in: XML
Expand |
Embed | Plain Text
<Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resource.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="buttonTemplate" TargetType="{x:Type Button}"> <Grid> <Ellipse x:Name="outerCircle"> <Ellipse.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0" Color="Blue" /> <GradientStop Offset="1" Color="Red" /> </LinearGradientBrush> </Ellipse.Fill> </Ellipse> <Ellipse x:Name="innerCircle" RenderTransformOrigin=".5,.5"> <Ellipse.RenderTransform> <ScaleTransform ScaleX=".8" ScaleY=".8" /> </Ellipse.RenderTransform> <Ellipse.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0" Color="Red" /> <GradientStop Offset="1" Color="Blue" /> </LinearGradientBrush> </Ellipse.Fill> </Ellipse> <Viewbox> <ContentPresenter Margin="{TemplateBinding Padding}" /> </Viewbox> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="outerCircle" Property="Fill" Value="Orange" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="RenderTransform" > <Setter.Value> <ScaleTransform ScaleX=".9" ScaleY=".9" /> </Setter.Value> </Setter> <Setter Property="RenderTransformOrigin" Value=".5,.5"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style x:Key="buttonStyle" TargetType="{x:Type Button}"> <Setter Property="Foreground" Value="Blue" /> <Setter Property="Background" Value="Black" /> <Setter Property="FontSize" Value="14" /> </Style> </ResourceDictionary> <Grid> <Button Margin="275,112,241,106" Name="button1" Template="{StaticResource buttonTemplate}" Click="button1_Click">Text</Button> <Button Margin="275,0,241,59" Name="button2" Style="{StaticResource buttonStyle}" Click="button1_Click" Height="23" VerticalAlignment="Bottom">Text</Button> </Grid>
You need to login to post a comment.
