跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

浏览文件

Button.xaml

109 行 · 7.0 KB历史下载
1<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3 xmlns:local="clr-namespace:UI.Controls.Button"
4 xmlns:base="clr-namespace:UI.Controls.Base"
5 xmlns:sys="clr-namespace:System;assembly=mscorlib">
6 <Style TargetType="{x:Type local:Button}">
7 <Setter Property="SnapsToDevicePixels"
8 Value="true" />
9 <Setter Property="UseLayoutRounding" Value="True"/>
10
11 <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/>
12 <Setter Property="Height" Value="35"/>
13 <Setter Property="Background" Value="{DynamicResource StandardBackgroundBrush}"/>
14 <Setter Property="Template">
15 <Setter.Value>
16 <ControlTemplate TargetType="{x:Type local:Button}">
17 <!--<Border x:Name="Border" SnapsToDevicePixels="True">-->
18 <Grid SnapsToDevicePixels="True">
19
20
21 <Border BorderBrush="#f3f3f3" BorderThickness="0" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" x:Name="BoxBorder" CornerRadius="4" Background="{TemplateBinding Background}">
22 <!--<Border.Effect>
23 <DropShadowEffect BlurRadius="5" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/>
24 </Border.Effect>-->
25 <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
26 <Grid.ColumnDefinitions>
27 <ColumnDefinition Width="auto"/>
28 <ColumnDefinition Width="auto"/>
29 </Grid.ColumnDefinitions>
30 <base:Icon x:Name="Icon" Margin="0,0,5,0" IconType="{TemplateBinding Icon}" VerticalAlignment="Center" FontSize="12" >
31
32 </base:Icon>
33 <ContentPresenter
34 Grid.Column="1"
35 HorizontalAlignment="Center"
36 VerticalAlignment="Center"
37 RecognizesAccessKey="True"/>
38 </Grid>
39
40 </Border>
41 <Border x:Name="Shadow" BorderBrush="{Binding ElementName=BoxBorder,Path=BorderBrush}" BorderThickness="{Binding ElementName=BoxBorder,Path=BorderThickness}" Panel.ZIndex="-1" Width="{Binding ElementName=BoxBorder,Path=ActualWidth}" Height="{Binding ElementName=BoxBorder,Path=ActualHeight}" CornerRadius="{Binding ElementName=BoxBorder,Path=CornerRadius}" Background="{Binding ElementName=BoxBorder,Path=Background}">
42 <Border.Effect>
43 <DropShadowEffect BlurRadius="5" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/>
44 </Border.Effect>
45 </Border>
46 <VisualStateManager.VisualStateGroups>
47 <VisualStateGroup x:Name="CommonStates">
48 <VisualStateGroup.Transitions>
49 <VisualTransition GeneratedDuration="0:0:0.18" />
50 <VisualTransition GeneratedDuration="0"
51 To="Pressed" />
52 </VisualStateGroup.Transitions>
53 <VisualState x:Name="Normal" />
54 <VisualState x:Name="MouseOver">
55 <Storyboard>
56 <!--<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Effect).(DropShadowEffect.Color)"
57 Storyboard.TargetName="Shadow">
58 <EasingColorKeyFrame KeyTime="0"
59 Value="#2b20d9" />
60 </ColorAnimationUsingKeyFrames>-->
61 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
62 Storyboard.TargetName="BoxBorder">
63 <EasingColorKeyFrame KeyTime="0"
64 Value="{DynamicResource HoverBackgroundColor}" />
65 </ColorAnimationUsingKeyFrames>
66 <!--<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
67 Storyboard.TargetName="BoxBorder">
68 <EasingColorKeyFrame KeyTime="0"
69 Value="#2b20d9" />
70 </ColorAnimationUsingKeyFrames>
71 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
72 >
73 <EasingColorKeyFrame KeyTime="0"
74 Value="White" />
75 </ColorAnimationUsingKeyFrames>-->
76 </Storyboard>
77 </VisualState>
78 <VisualState x:Name="Pressed">
79 <Storyboard>
80
81
82 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
83 Storyboard.TargetName="BoxBorder">
84 <EasingColorKeyFrame KeyTime="0"
85 Value="{DynamicResource ThemeColor}" />
86 </ColorAnimationUsingKeyFrames>
87
88 </Storyboard>
89 </VisualState>
90 </VisualStateGroup>
91 </VisualStateManager.VisualStateGroups>
92
93 </Grid>
94
95 <!--</Border>-->
96 <ControlTemplate.Triggers>
97 <Trigger Property="Icon" Value="None">
98 <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
99 </Trigger>
100 <Trigger Property="IsMouseOver" Value="True">
101 <Setter TargetName="BoxBorder" Property="BorderThickness" Value="0"/>
102 <!--<Setter Property="Foreground" Value="White"/>-->
103 </Trigger>
104 </ControlTemplate.Triggers>
105 </ControlTemplate>
106 </Setter.Value>
107 </Setter>
108 </Style>
109</ResourceDictionary>