|
<Style x:Key="CustomMetroRectToggleButtonStyle" TargetType="{x:Type ToggleButton}"> |
|
<Setter Property="Background" Value="Transparent" /> |
|
<Setter Property="BorderBrush" Value="{DynamicResource GrayBrush3}" /> |
|
<Setter Property="BorderThickness" Value="2" /> |
|
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}" /> |
|
<Setter Property="HorizontalContentAlignment" Value="Center" /> |
|
<Setter Property="Padding" Value="1" /> |
|
<Setter Property="SnapsToDevicePixels" Value="True" /> |
|
<Setter Property="Template"> |
|
<Setter.Value> |
|
<ControlTemplate TargetType="{x:Type ToggleButton}"> |
|
<Grid> |
|
<Border Background="{TemplateBinding Background}" |
|
BorderThickness="0" |
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
|
<Border x:Name="IsCheckedBackgroundRect" |
|
Background="{DynamicResource AccentColorBrush}" |
|
Opacity="0" |
|
BorderThickness="0" |
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
|
<Border x:Name="BorderRect" |
|
Opacity="1" |
|
BorderBrush="{TemplateBinding BorderBrush}" |
|
BorderThickness="{TemplateBinding BorderThickness}" |
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
|
<Controls:ContentControlEx x:Name="PART_ContentPresenter" |
|
Padding="{TemplateBinding Padding}" |
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|
Content="{TemplateBinding Content}" |
|
ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.ContentCharacterCasing)}" |
|
ContentStringFormat="{TemplateBinding ContentStringFormat}" |
|
ContentTemplate="{TemplateBinding ContentTemplate}" |
|
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" |
|
RecognizesAccessKey="True" |
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
|
</Grid> |
|
<ControlTemplate.Triggers> |
|
<Trigger Property="ToggleButton.IsChecked" Value="True"> |
|
<Trigger.EnterActions> |
|
<BeginStoryboard> |
|
<Storyboard> |
|
<DoubleAnimation Storyboard.TargetName="IsCheckedBackgroundRect" |
|
Storyboard.TargetProperty="Opacity" |
|
From="0" |
|
To="1" |
|
Duration="0:0:0.3" /> |
|
</Storyboard> |
|
</BeginStoryboard> |
|
</Trigger.EnterActions> |
|
<!-- some out fading --> |
|
<Trigger.ExitActions> |
|
<BeginStoryboard> |
|
<Storyboard> |
|
<DoubleAnimation Storyboard.TargetName="IsCheckedBackgroundRect" |
|
Storyboard.TargetProperty="Opacity" |
|
To="0" |
|
Duration="0:0:0.3" /> |
|
</Storyboard> |
|
</BeginStoryboard> |
|
</Trigger.ExitActions> |
|
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundColorBrush}" /> |
|
<Setter TargetName="BorderRect" Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" /> |
|
</Trigger> |
|
<Trigger Property="IsMouseOver" Value="False"> |
|
<Setter TargetName="BorderRect" Property="Opacity" Value="0.7" /> |
|
</Trigger> |
|
<Trigger Property="IsEnabled" Value="False"> |
|
<Setter Property="Foreground" Value="{DynamicResource GrayBrush7}" /> |
|
<Setter TargetName="BorderRect" Property="Opacity" Value="0.3" /> |
|
</Trigger> |
|
</ControlTemplate.Triggers> |
|
</ControlTemplate> |
|
</Setter.Value> |
|
</Setter> |
|
<Setter Property="VerticalContentAlignment" Value="Center" /> |
|
</Style> |