|
| 1 | +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:GitHub.UI"> |
| 2 | + |
| 3 | + <Style x:Key="OcticonButton" TargetType="{x:Type ui:OcticonButton}"> |
| 4 | + <Setter Property="Focusable" Value="True"/> |
| 5 | + <Setter Property="Foreground" Value="Black"/> |
| 6 | + <Setter Property="Height" Value="16"/> |
| 7 | + <Setter Property="Width" Value="16"/> |
| 8 | + <Setter Property="Margin" Value="0"/> |
| 9 | + <Setter Property="Padding" Value="0"/> |
| 10 | + <Setter Property="HorizontalAlignment" Value="Center"/> |
| 11 | + <Setter Property="VerticalAlignment" Value="Center"/> |
| 12 | + <Setter Property="BorderBrush" Value="Transparent"/> |
| 13 | + <Setter Property="Template"> |
| 14 | + <Setter.Value> |
| 15 | + <ControlTemplate TargetType="ui:OcticonButton"> |
| 16 | + <Grid x:Name="content" Margin="{TemplateBinding Margin}" Background="Transparent"> |
| 17 | + <VisualStateManager.VisualStateGroups> |
| 18 | + <VisualStateGroup x:Name="CommonStates"> |
| 19 | + <VisualState x:Name="Normal"/> |
| 20 | + <VisualState x:Name="MouseOver"> |
| 21 | + <Storyboard> |
| 22 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> |
| 23 | + <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
| 24 | + </DoubleAnimationUsingKeyFrames> |
| 25 | + </Storyboard> |
| 26 | + </VisualState> |
| 27 | + <VisualState x:Name="Pressed"> |
| 28 | + <Storyboard> |
| 29 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> |
| 30 | + <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
| 31 | + </DoubleAnimationUsingKeyFrames> |
| 32 | + </Storyboard> |
| 33 | + </VisualState> |
| 34 | + <VisualState x:Name="Disabled"> |
| 35 | + <Storyboard> |
| 36 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity"> |
| 37 | + <SplineDoubleKeyFrame KeyTime="0" Value="0.5"/> |
| 38 | + </DoubleAnimationUsingKeyFrames> |
| 39 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)"> |
| 40 | + <EasingDoubleKeyFrame KeyTime="0" Value="0.5"/> |
| 41 | + </DoubleAnimationUsingKeyFrames> |
| 42 | + </Storyboard> |
| 43 | + </VisualState> |
| 44 | + </VisualStateGroup> |
| 45 | + <VisualStateGroup x:Name="FocusStates"> |
| 46 | + <VisualState x:Name="Focused"/> |
| 47 | + <VisualState x:Name="Unfocused"/> |
| 48 | + </VisualStateGroup> |
| 49 | + </VisualStateManager.VisualStateGroups> |
| 50 | + <Grid.ColumnDefinitions> |
| 51 | + <ColumnDefinition Width="Auto"/> |
| 52 | + </Grid.ColumnDefinitions> |
| 53 | + <Border x:Name="Background" |
| 54 | + Background="{TemplateBinding Background}" |
| 55 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 56 | + BorderThickness="1" |
| 57 | + SnapsToDevicePixels="True"/> |
| 58 | + <Rectangle x:Name="DisabledVisualElement" |
| 59 | + Fill="#FFFCFCFC" |
| 60 | + IsHitTestVisible="False" |
| 61 | + Opacity="0" |
| 62 | + SnapsToDevicePixels="True"/> |
| 63 | + <Border x:Name="MouseOverBorder" |
| 64 | + Background="#FFDDDDE6" |
| 65 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 66 | + BorderThickness="1" |
| 67 | + Opacity="0" |
| 68 | + SnapsToDevicePixels="True"/> |
| 69 | + <Border x:Name="PressedBorder" |
| 70 | + Background="#FFCFCFDB" |
| 71 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 72 | + BorderThickness="1" |
| 73 | + Opacity="0" |
| 74 | + SnapsToDevicePixels="True"/> |
| 75 | + <Border x:Name="DefaultVisualElement" |
| 76 | + Background="Transparent" |
| 77 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 78 | + BorderThickness="1" |
| 79 | + Opacity="0" |
| 80 | + SnapsToDevicePixels="True"/> |
| 81 | + <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="16" Height="16"> |
| 82 | + <Border BorderBrush="Transparent" BorderThickness="1"> |
| 83 | + |
| 84 | + <ui:OcticonPath Height="16" |
| 85 | + Fill="{TemplateBinding Foreground}" |
| 86 | + Icon="{TemplateBinding Icon}" |
| 87 | + SnapsToDevicePixels="True"/> |
| 88 | + </Border> |
| 89 | + </Viewbox> |
| 90 | + </Grid> |
| 91 | + <ControlTemplate.Triggers> |
| 92 | + <Trigger Property="IsDefaulted" Value="True"> |
| 93 | + <Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/> |
| 94 | + </Trigger> |
| 95 | + <Trigger Property="IsKeyboardFocused" Value="True"> |
| 96 | + <Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/> |
| 97 | + </Trigger> |
| 98 | + </ControlTemplate.Triggers> |
| 99 | + </ControlTemplate> |
| 100 | + </Setter.Value> |
| 101 | + </Setter> |
| 102 | + </Style> |
| 103 | + |
| 104 | + <Style BasedOn="{StaticResource OcticonButton}" TargetType="{x:Type ui:OcticonButton}"/> |
| 105 | +</ResourceDictionary> |
0 commit comments