跳到主要内容

github/tai

公开

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

浏览文件

Charts.xaml

351 行 · 23.6 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.Charts" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:converter="clr-namespace:UI.Controls.Converters" xmlns:input="clr-namespace:UI.Controls.Input">
4 <converter:HextoColorConverter x:Key="HextoColorConverter"/>
5 <Style TargetType="{x:Type local:Charts}">
6 <Setter Property="SnapsToDevicePixels"
7 Value="true" />
8
9 <Setter Property="FontSize" Value="14"/>
10 <Setter Property="Background" Value="Transparent"/>
11
12 <Setter Property="Template">
13 <Setter.Value>
14 <ControlTemplate TargetType="{x:Type local:Charts}">
15 <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
16 <Border x:Name="Radar" Visibility="Collapsed">
17
18 </Border>
19 <Canvas x:Name="CommonCanvasContainer" Visibility="Collapsed">
20
21 </Canvas>
22 <Grid x:Name="List" Visibility="Collapsed" >
23 <Grid.RowDefinitions>
24 <RowDefinition Height="auto"/>
25 <RowDefinition Height="*"/>
26 </Grid.RowDefinitions>
27 <Grid x:Name="AHeader" Visibility="Collapsed">
28 <Grid.RowDefinitions>
29 <RowDefinition Height="auto"/>
30 <RowDefinition Height="*"/>
31 </Grid.RowDefinitions>
32 <TextBlock FontSize="14" Foreground="{DynamicResource SubTextBrush}">
33 <Run Text="总计"/>
34 <Run x:Name="ACount"/>
35 <Run Text="个"/>
36 </TextBlock>
37 <input:InputBox IconColor="{DynamicResource DefaultTextBrush}" x:Name="ASearchBox" Grid.Row="1" Placeholder="搜索" Margin="0,10,0,10" BoxPadding="5,0" Icon="Search"/>
38 </Grid>
39 <StackPanel x:Name="TypeATempContainer" Grid.Row="1" Visibility="Collapsed"/>
40 <!--list-->
41 <ListView x:Name="ListView" Grid.Row="1" ItemsSource="{TemplateBinding ListViewBindingData}" VirtualizingPanel.IsVirtualizing="True" >
42 <ListBox.Resources>
43 <Style TargetType="{x:Type ListView}">
44 <Setter Property="OverridesDefaultStyle" Value="True"/>
45
46 <Setter Property="Template">
47 <Setter.Value>
48 <ControlTemplate TargetType="{x:Type ListView}">
49 <ScrollViewer VerticalScrollBarVisibility="Auto" CanContentScroll="True">
50 <ItemsPresenter />
51 </ScrollViewer>
52 </ControlTemplate>
53 </Setter.Value>
54 </Setter>
55 </Style>
56 <Style TargetType="{x:Type ListViewItem}">
57 <Setter Property="OverridesDefaultStyle" Value="True"/>
58 <Setter Property="Template">
59 <Setter.Value>
60 <ControlTemplate TargetType="{x:Type ListViewItem}">
61 <ContentPresenter/>
62 </ControlTemplate>
63 </Setter.Value>
64 </Setter>
65
66 </Style>
67 </ListBox.Resources>
68 <ListBox.ItemsPanel>
69 <ItemsPanelTemplate>
70 <VirtualizingStackPanel/>
71 </ItemsPanelTemplate>
72 </ListBox.ItemsPanel>
73 <ListView.ItemTemplate>
74 <DataTemplate>
75 <Border>
76 <local:ChartsItemTypeList IconSize="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Charts}}, Path=IconSize}" Data="{Binding}" MaxValue="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Charts}}, Path=DataMaxValue}" IsShowBadge="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Charts}}, Path=IsShowBadge}"/>
77 </Border>
78 </DataTemplate>
79 </ListView.ItemTemplate>
80 </ListView>
81 <!--end-->
82 <!--<StackPanel Grid.Row="1" Visibility="Collapsed" x:Name="NoScrollContainer"></StackPanel>-->
83 </Grid>
84 <WrapPanel x:Name="CardContainer" Visibility="Collapsed">
85 </WrapPanel>
86 <Grid x:Name="MonthContainer" Visibility="Collapsed">
87 </Grid>
88
89 <Grid x:Name="Column" Visibility="Collapsed">
90 <base:EmptyData x:Name="ColumnEmpty" Visibility="Collapsed"/>
91 <Grid x:Name="ColumnMain">
92 <Grid.RowDefinitions>
93 <RowDefinition Height="auto"/>
94 <RowDefinition Height="*"/>
95 <RowDefinition Height="auto"/>
96 </Grid.RowDefinitions>
97 <StackPanel x:Name="ColumnTotal">
98 <TextBlock Text="总计" Foreground="{DynamicResource SubTextBrush}"/>
99 <TextBlock Margin="0,5,0,0" Text="{TemplateBinding Total}" FontSize="20" Foreground="{DynamicResource DefaultTextBrush}"/>
100 </StackPanel>
101 <Grid Grid.Row="1" Margin="0,20,0,0">
102 <Popup
103 AllowsTransparency="True"
104 IsOpen="{TemplateBinding IsShowValuesPopup}"
105 Placement="Top"
106 PlacementTarget="{TemplateBinding ValuesPopupPlacementTarget}"
107 HorizontalOffset="{TemplateBinding ValuesPopupHorizontalOffset}">
108 <Border
109 Background="{DynamicResource PopupBackgroundBrush}"
110 CornerRadius="12"
111 Padding="10"
112 Margin="10">
113 <Border.Effect>
114 <DropShadowEffect BlurRadius="10" ShadowDepth="0" Direction="0" Color="Gray" Opacity=".1"/>
115 </Border.Effect>
116
117 <Grid>
118 <Path
119 Width="15"
120 Height="15"
121 SnapsToDevicePixels="False"
122 Data="M 0 0 L 7.5 7.5 L 15 0" Fill="{DynamicResource PopupBackgroundBrush}"
123 Stroke="{DynamicResource PopupBackgroundBrush}"
124 StrokeThickness="1"
125 VerticalAlignment="Bottom"
126 HorizontalAlignment="Left"
127 Margin="0,0,0,-22"
128 />
129 <!--列数据-->
130 <ListView ItemsSource="{TemplateBinding ColumnValuesInfoList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
131 <ListBox.Resources>
132 <Style TargetType="{x:Type ListView}">
133 <Setter Property="OverridesDefaultStyle" Value="True"/>
134
135 <Setter Property="Template">
136 <Setter.Value>
137 <ControlTemplate TargetType="{x:Type ListView}">
138 <Border>
139 <ItemsPresenter />
140 </Border>
141 </ControlTemplate>
142 </Setter.Value>
143 </Setter>
144 </Style>
145 <Style TargetType="{x:Type ListViewItem}">
146 <Setter Property="OverridesDefaultStyle" Value="True"/>
147 <Setter Property="Template">
148 <Setter.Value>
149 <ControlTemplate TargetType="{x:Type ListViewItem}">
150 <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Margin="0" CornerRadius="10">
151
152 <ContentPresenter/>
153 </Border>
154 </ControlTemplate>
155 </Setter.Value>
156 </Setter>
157
158 </Style>
159 </ListBox.Resources>
160 <ListBox.ItemsPanel>
161 <ItemsPanelTemplate>
162 <VirtualizingStackPanel/>
163 </ItemsPanelTemplate>
164 </ListBox.ItemsPanel>
165 <ListView.ItemTemplate>
166 <DataTemplate>
167
168 <StackPanel>
169 <Grid>
170 <Grid.ColumnDefinitions>
171 <ColumnDefinition Width="auto"/>
172 <ColumnDefinition Width="auto"/>
173 <ColumnDefinition Width="auto"/>
174
175 </Grid.ColumnDefinitions>
176 <base:View Condition="not null" Value="{Binding Color}">
177 <Border Margin="0,0,5,0" Width="10" CornerRadius="4" Height="10" Background="{Binding Color,Converter={StaticResource HextoColorConverter}}">
178 <!--颜色-->
179 </Border>
180 </base:View>
181
182
183 <Border Grid.Column="1" Margin="0,0,0,0">
184 <!--名称-->
185 <TextBlock Foreground="{DynamicResource DefaultTextBrush}" VerticalAlignment="Center" Text="{Binding Name}" FontSize="12"/>
186 </Border>
187 <Border Grid.Column="2">
188 <!--总计和百分比-->
189 <TextBlock FontSize="12" Margin="5,0,0,0" Foreground="{DynamicResource SubTextBrush}" VerticalAlignment="Center" Text="{Binding Text}"/>
190
191 </Border>
192
193 </Grid>
194
195 </StackPanel>
196 </DataTemplate>
197 </ListView.ItemTemplate>
198 </ListView>
199 </Grid>
200 </Border>
201 </Popup>
202
203 <Border BorderThickness="1,0,0,1" BorderBrush="{DynamicResource ChartColBorderBrush}">
204 <Canvas x:Name="TypeColumnCanvas"/>
205 </Border>
206
207 </Grid>
208 <!--信息-->
209 <Grid Grid.Row="2" Margin="0,5,0,0" x:Name="Category" Visibility="Collapsed">
210 <ListView ItemsSource="{TemplateBinding ColumnInfoList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
211 <ListBox.Resources>
212 <Style TargetType="{x:Type ListView}">
213 <Setter Property="OverridesDefaultStyle" Value="True"/>
214
215 <Setter Property="Template">
216 <Setter.Value>
217 <ControlTemplate TargetType="{x:Type ListView}">
218 <Border>
219 <ItemsPresenter />
220 </Border>
221 </ControlTemplate>
222 </Setter.Value>
223 </Setter>
224 </Style>
225 <Style TargetType="{x:Type ListViewItem}">
226 <Setter Property="OverridesDefaultStyle" Value="True"/>
227 <Setter Property="Template">
228 <Setter.Value>
229 <ControlTemplate TargetType="{x:Type ListViewItem}">
230 <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="Transparent" Margin="0" CornerRadius="10">
231
232 <ContentPresenter/>
233 </Border>
234 <!--<ControlTemplate.Triggers>
235 <Trigger Property="IsMouseOver" Value="True">
236 -->
237 <!--<Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/>-->
238 <!--
239 <Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>
240
241 </Trigger>
242 </ControlTemplate.Triggers>-->
243 </ControlTemplate>
244 </Setter.Value>
245 </Setter>
246
247 </Style>
248 </ListBox.Resources>
249 <ListBox.ItemsPanel>
250 <ItemsPanelTemplate>
251 <WrapPanel/>
252 </ItemsPanelTemplate>
253 </ListBox.ItemsPanel>
254 <ListView.ItemTemplate>
255 <DataTemplate>
256
257 <WrapPanel Orientation="Vertical">
258 <StackPanel Orientation="Horizontal" Margin="0,0,10,5">
259 <Rectangle Width="12" RadiusX="4" RadiusY="4" Height="12" Fill="{Binding Color,Converter={StaticResource HextoColorConverter}}">
260 <!--颜色-->
261 </Rectangle>
262
263 <base:Img Margin="5,0,0,0" Width="16" Height="16" URL="{Binding Icon}"/>
264 <!--名称-->
265 <TextBlock Margin="5,0,0,0" Foreground="{DynamicResource DefaultTextBrush}" VerticalAlignment="Center" Text="{Binding Name}"/>
266
267 <!--总计和百分比-->
268 <TextBlock FontSize="12" Margin="5,0,0,0" Foreground="{DynamicResource SubTextBrush}" VerticalAlignment="Center" Text="{Binding Text}"/>
269
270 </StackPanel>
271 </WrapPanel>
272 </DataTemplate>
273 </ListView.ItemTemplate>
274 </ListView>
275 </Grid>
276 </Grid>
277 </Grid>
278 </Grid>
279
280 <ControlTemplate.Triggers>
281 <Trigger Property="IsShowCategory" Value="True">
282 <Setter Property="Visibility" Value="Visible" TargetName="Category"/>
283 </Trigger>
284 <MultiTrigger>
285 <MultiTrigger.Conditions>
286 <Condition Property="IsEmpty" Value="True"/>
287 <Condition Property="ChartsType" Value="Column"/>
288 </MultiTrigger.Conditions>
289 <Setter Property="Visibility" Value="Visible" TargetName="ColumnEmpty"/>
290 <Setter Property="Visibility" Value="Collapsed" TargetName="ColumnMain"/>
291 </MultiTrigger>
292 <MultiTrigger>
293 <MultiTrigger.Conditions>
294 <Condition Property="IsShowTotal" Value="False"/>
295 <Condition Property="ChartsType" Value="Column"/>
296 </MultiTrigger.Conditions>
297 <Setter Property="Visibility" Value="Collapsed" TargetName="ColumnTotal"/>
298 </MultiTrigger>
299 <MultiTrigger>
300 <MultiTrigger.Conditions>
301 <Condition Property="IsSearch" Value="True"/>
302 <Condition Property="ChartsType" Value="List"/>
303 </MultiTrigger.Conditions>
304 <Setter Property="Visibility" Value="Visible" TargetName="AHeader"/>
305 </MultiTrigger>
306 <Trigger Property="ChartsType"
307 Value="List">
308 <Setter TargetName="List" Property="Visibility" Value="Visible"/>
309 </Trigger>
310 <Trigger Property="ChartsType"
311 Value="Card">
312 <Setter TargetName="CardContainer" Property="Visibility" Value="Visible"/>
313 </Trigger>
314 <Trigger Property="ChartsType"
315 Value="Month">
316 <Setter TargetName="MonthContainer" Property="Visibility" Value="Visible"/>
317 </Trigger>
318 <Trigger Property="ChartsType"
319 Value="Column">
320 <Setter TargetName="Column" Property="Visibility" Value="Visible"/>
321 </Trigger>
322 <Trigger Property="ChartsType"
323 Value="Radar">
324 <Setter TargetName="Radar" Property="Visibility" Value="Visible"/>
325 </Trigger>
326 <Trigger Property="ChartsType"
327 Value="Pie">
328 <Setter TargetName="CommonCanvasContainer" Property="Visibility" Value="Visible"/>
329 </Trigger>
330 <MultiTrigger>
331 <MultiTrigger.Conditions>
332 <Condition Property="IsLoading" Value="True"/>
333 <Condition Property="ChartsType" Value="List"/>
334 </MultiTrigger.Conditions>
335 <Setter Property="Visibility" Value="Visible" TargetName="TypeATempContainer"/>
336 <Setter Property="Visibility" Value="Collapsed" TargetName="ListView"/>
337 </MultiTrigger>
338 <MultiTrigger>
339 <MultiTrigger.Conditions>
340 <Condition Property="IsEmpty" Value="True"/>
341 <Condition Property="ChartsType" Value="List"/>
342 </MultiTrigger.Conditions>
343 <Setter Property="Visibility" Value="Visible" TargetName="TypeATempContainer"/>
344 <Setter Property="Visibility" Value="Collapsed" TargetName="ListView"/>
345 </MultiTrigger>
346 </ControlTemplate.Triggers>
347 </ControlTemplate>
348 </Setter.Value>
349 </Setter>
350 </Style>
351</ResourceDictionary>