<Style TargetType= "{x:Type local:ButtonEx}" >
<Style.Triggers>
<Trigger Property= "ButtonType" Value= "Normal" >
<Setter Property= "Background" Value= "#43a9c7" />
<Setter Property= "MouseOverBackground" Value= "#2f96b4" />
<Setter Property= "MousePressedBackground" Value= "#2a89a4" />
<Setter Property= "Foreground" Value= "White" />
<Setter Property= "MouseOverForeground" Value= "White" />
<Setter Property= "MousePressedForeground" Value= "White" />
<Setter Property= "BorderBrush" Value= "Transparent" />
<Setter Property= "BorderThickness" Value= "0" />
<Setter Property= "Template" >
<Setter.Value>
<ControlTemplate TargetType= "{x:Type local:ButtonEx}" >
<Border x:Name= "border" Background= "{TemplateBinding Background}" CornerRadius= "{TemplateBinding CornerRadius}" BorderBrush= "{TemplateBinding BorderBrush}" BorderThickness= "{TemplateBinding BorderThickness}" Width= "{TemplateBinding Width}" Height= "{TemplateBinding Height}" SnapsToDevicePixels= "True" >
<TextBlock x:Name= "txt" Text= "{TemplateBinding Content}" Foreground= "{TemplateBinding Foreground}" VerticalAlignment= "Center" HorizontalAlignment= "Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property= "IsMouseOver" Value= "True" >
<Setter TargetName= "border" Property= "Background" Value= "{Binding MouseOverBackground,RelativeSource={RelativeSource TemplatedParent}}" />
<Setter TargetName= "txt" Property= "Foreground" Value= "{Binding MouseOverForeground,RelativeSource={RelativeSource TemplatedParent}}" />
<Setter TargetName= "border" Property= "BorderBrush" Value= "{Binding MouseOverBorderbrush,RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
<Trigger Property= "IsPressed" Value= "True" >
<Setter TargetName= "border" Property= "Background" Value= "{Binding MousePressedBackground,RelativeSource={RelativeSource TemplatedParent}}" />
<Setter TargetName= "txt" Property= "Foreground" Value= "{Binding MousePressedForeground,RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property= "ButtonType" Value= "Icon" >
<Setter Property= "Cursor" Value= "Hand" />
<Setter Property= "Template" >
<Setter.Value>
<ControlTemplate TargetType= "{x:Type local:ButtonEx}" >
<Border Width= "{TemplateBinding Width}" Height= "{TemplateBinding Height}" >
<Image x:Name= "Img" VerticalAlignment= "Center" HorizontalAlignment= "Center" Source= "{TemplateBinding Icon}" Stretch= "None" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property= "IsMouseOver" Value= "True" >
<Setter Property= "Opacity" Value= "0.8" />
</Trigger>
<Trigger Property= "IsPressed" Value= "True" >
<Setter Property= "Opacity" Value= "0.9" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property= "ButtonType" Value= "Text" >
<Setter Property= "Cursor" Value= "Hand" />
<Setter Property= "Foreground" Value= "#002c99" />
<Setter Property= "MouseOverForeground" Value= "#FF2c99" />
<Setter Property= "MousePressedForeground" Value= "#002c99" />
<Setter Property= "Template" >
<Setter.Value>
<ControlTemplate TargetType= "{x:Type local:ButtonEx}" >
<TextBlock x:Name= "txt" Text= "{TemplateBinding Content}" Foreground= "{TemplateBinding Foreground}" VerticalAlignment= "Center" HorizontalAlignment= "Center" />
<ControlTemplate.Triggers>
<Trigger Property= "IsMouseOver" Value= "True" >
<Setter Property= "Foreground" Value= "{Binding MouseOverForeground,RelativeSource={RelativeSource TemplatedParent}}" TargetName= "txt" />
</Trigger>
<Trigger Property= "IsPressed" Value= "True" >
<Setter Property= "Foreground" Value= "{Binding MousePressedForeground,RelativeSource={RelativeSource TemplatedParent}}" TargetName= "txt" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property= "ButtonType" Value= "IconText" >
<Setter Property= "Cursor" Value= "Hand" />
<Setter Property= "Foreground" Value= "#555" />
<Setter Property= "MouseOverForeground" Value= "#555" />
<Setter Property= "MousePressedForeground" Value= "#555" />
<Setter Property= "Template" >
<Setter.Value>
<ControlTemplate TargetType= "{x:Type local:ButtonEx}" >
<Border>
<StackPanel Orientation= "Horizontal" HorizontalAlignment= "Center" >
<Image Source= "{TemplateBinding Icon}" Stretch= "None" />
<TextBlock x:Name= "Txt" Text= "{TemplateBinding Content}" Foreground= "{TemplateBinding Foreground}" VerticalAlignment= "Center" HorizontalAlignment= "Center" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property= "IsMouseOver" Value= "True" >
<Setter Property= "Foreground" Value= "{Binding MouseOverForeground,RelativeSource={RelativeSource TemplatedParent}}" TargetName= "Txt" />
</Trigger>
<Trigger Property= "IsPressed" Value= "True" >
<Setter Property= "Foreground" Value= "{Binding MousePressedForeground,RelativeSource={RelativeSource TemplatedParent}}" TargetName= "Txt" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
|