跳到主要内容

github/tai

公开

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

浏览文件

Option.xaml

90 行 · 4.8 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.Select" xmlns:base="clr-namespace:UI.Controls.Base">
4 <Style TargetType="{x:Type local:Option}">
5 <Setter Property="SnapsToDevicePixels"
6 Value="true" />
7
8 <Setter Property="Background" Value="Transparent"/>
9 <!--<Setter Property="Height" Value="15"/>-->
10
11 <Setter Property="Template">
12 <Setter.Value>
13 <ControlTemplate TargetType="{x:Type local:Option}">
14 <Border CornerRadius="10" Background="{TemplateBinding Background}" Padding="10,8">
15
16 <Border>
17 <Grid>
18 <Grid.ColumnDefinitions>
19 <ColumnDefinition Width="30"/>
20
21 <ColumnDefinition Width="auto"/>
22 <ColumnDefinition Width="*"/>
23
24 </Grid.ColumnDefinitions>
25 <!--标记是否选中-->
26 <Border>
27 <Grid>
28 <!--选中-->
29 <Border
30 Width="20"
31 Height="20"
32 Background="{DynamicResource ThemeBrush}"
33 BorderBrush="{DynamicResource ThemeBrush}"
34 BorderThickness="2"
35 CornerRadius="20"
36 x:Name="CheckStyle" Visibility="Collapsed">
37 <Border.Effect>
38 <DropShadowEffect BlurRadius="10" ShadowDepth="0" Direction="0" Color="Gray" Opacity=".3"/>
39 </Border.Effect>
40 </Border>
41
42 <!--未选中-->
43 <Border
44 Width="20"
45 Height="20"
46 BorderBrush="#ccc"
47 BorderThickness="2"
48 CornerRadius="20"
49 x:Name="UnCheckStyle" Visibility="Collapsed">
50
51 </Border>
52 </Grid>
53 </Border>
54 <!--图标-->
55 <Border Grid.Column="1" Margin="5,0,0,0" x:Name="Img">
56 <base:Img URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Option}}, Path=Value.Img}" Width="16" Height="16" VerticalAlignment="Center"/>
57 </Border>
58 <!--文字-->
59 <Border Grid.Column="2">
60 <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Option}}, Path=Value.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/>
61 </Border>
62 </Grid>
63 </Border>
64
65
66
67
68 </Border>
69 <ControlTemplate.Triggers>
70 <Trigger Property="IsShowIcon" Value="False">
71 <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/>
72 </Trigger>
73 <Trigger Property="IsChecked" Value="True">
74 <Setter TargetName="CheckStyle" Property="Visibility" Value="Visible"/>
75 <Setter TargetName="UnCheckStyle" Property="Visibility" Value="Collapsed"/>
76 </Trigger>
77 <Trigger Property="IsChecked" Value="False">
78 <Setter TargetName="CheckStyle" Property="Visibility" Value="Collapsed"/>
79 <Setter TargetName="UnCheckStyle" Property="Visibility" Value="Visible"/>
80 </Trigger>
81 <Trigger Property="IsMouseOver" Value="True">
82 <Setter Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/>
83 </Trigger>
84 </ControlTemplate.Triggers>
85
86 </ControlTemplate>
87 </Setter.Value>
88 </Setter>
89 </Style>
90</ResourceDictionary>