-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml
More file actions
303 lines (285 loc) · 19.5 KB
/
App.xaml
File metadata and controls
303 lines (285 loc) · 19.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<Application x:Class="ContextMenuEditor.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:util="clr-namespace:ContextMenuEditor.Utilities"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
StartupUri="Views/MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps base resources -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Default theme (will be swapped at runtime by ThemeManager) -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Subtle tweak so ToggleSwitch remains visible in light mode -->
<Style TargetType="mah:ToggleSwitch" BasedOn="{StaticResource {x:Type mah:ToggleSwitch}}">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
</Style>
<!-- Converters -->
<util:ThemeLabelConverter x:Key="ThemeLabelConverter"/>
<!-- Shared DataGrid column templates for consistency across views -->
<Style x:Key="ActionPanelBorder" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}"/>
</Style>
<Style x:Key="RightActionColumn" TargetType="ColumnDefinition">
<Setter Property="Width" Value="120"/>
</Style>
<Style x:Key="MainGridColumn" TargetType="ColumnDefinition">
<Setter Property="Width" Value="*"/>
</Style>
<!-- Global styles and resources -->
<Style TargetType="Window">
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
</Style>
<Style TargetType="Button">
<Setter Property="Padding" Value="12,6"/>
<Setter Property="Margin" Value="0,0,0,8"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
TextBlock.Foreground="{TemplateBinding Foreground}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonPressedBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DataGrid">
<Setter Property="AutoGenerateColumns" Value="False"/>
<Setter Property="CanUserAddRows" Value="False"/>
<Setter Property="CanUserDeleteRows" Value="False"/>
<Setter Property="SelectionMode" Value="Extended"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="RowBackground" Value="{DynamicResource ControlBackgroundBrush}"/>
<Setter Property="AlternatingRowBackground" Value="{DynamicResource AlternateRowBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource GridLineBrush}"/>
<!-- Standardize scrolling behavior for all DataGrids -->
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<!-- Use pixel-based scrolling with virtualization (recommended) -->
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
<!-- Default item-based scrolling avoids edge-cases with DataGrid template -->
<!-- Keep virtualization for performance -->
<Setter Property="EnableColumnVirtualization" Value="True"/>
<Setter Property="EnableRowVirtualization" Value="True"/>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource HeaderBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="0,0,1,1"/>
<Setter Property="Padding" Value="8,4"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<!-- Ensure header tooltips show with consistent style -->
<Setter Property="ToolTipService.ShowDuration" Value="30000"/>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Style.Triggers>
<!-- Disabled items appear grayed out -->
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
<Setter Property="Foreground" Value="#808080"/>
<Setter Property="FontStyle" Value="Italic"/>
</DataTrigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource SelectionBackgroundBrush}"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonHoverBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Padding" Value="4,2"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
</Style>
<Style TargetType="Border">
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
</Style>
<Style TargetType="GridSplitter">
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
</Style>
<Style TargetType="StackPanel">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style TargetType="Separator">
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
</Style>
<Style TargetType="StatusBar">
<Setter Property="Background" Value="{DynamicResource HeaderBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
</Style>
<!-- Use MahApps default ToggleSwitch template for proper interaction -->
<!-- Themed ScrollBar template that preserves default behavior (line/page buttons, full-track thumb travel) -->
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="{DynamicResource ScrollBarTrackBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid Background="{TemplateBinding Background}">
<DockPanel LastChildFill="True">
<!-- Line buttons at the ends -->
<RepeatButton x:Name="LineStart" Width="16" Height="16" Focusable="False" Background="Transparent" BorderBrush="Transparent" DockPanel.Dock="Left" Command="{x:Static ScrollBar.LineLeftCommand}"/>
<RepeatButton x:Name="LineEnd" Width="16" Height="16" Focusable="False" Background="Transparent" BorderBrush="Transparent" DockPanel.Dock="Right" Command="{x:Static ScrollBar.LineRightCommand}"/>
<!-- Track with page buttons and thumb -->
<Track x:Name="PART_Track"
Orientation="{TemplateBinding Orientation}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Value="{TemplateBinding Value}"
ViewportSize="{TemplateBinding ViewportSize}">
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="PART_Decrease" Command="{x:Static ScrollBar.PageLeftCommand}" Background="{DynamicResource ScrollBarTrackBrush}" BorderBrush="Transparent" Focusable="False"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="PART_Increase" Command="{x:Static ScrollBar.PageRightCommand}" Background="{DynamicResource ScrollBarTrackBrush}" BorderBrush="Transparent" Focusable="False"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Focusable="False">
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Border x:Name="PART_Border" Background="{DynamicResource ScrollBarThumbBrush}" CornerRadius="2"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource ScrollBarThumbHoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</DockPanel>
</Grid>
<ControlTemplate.Triggers>
<!-- Vertical orientation tweaks -->
<Trigger Property="Orientation" Value="Vertical">
<Setter TargetName="LineStart" Property="DockPanel.Dock" Value="Top"/>
<Setter TargetName="LineEnd" Property="DockPanel.Dock" Value="Bottom"/>
<Setter TargetName="LineStart" Property="Command" Value="{x:Static ScrollBar.LineUpCommand}"/>
<Setter TargetName="LineEnd" Property="Command" Value="{x:Static ScrollBar.LineDownCommand}"/>
<Setter TargetName="PART_Decrease" Property="Command" Value="{x:Static ScrollBar.PageUpCommand}"/>
<Setter TargetName="PART_Increase" Property="Command" Value="{x:Static ScrollBar.PageDownCommand}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
</Style>
<!-- ToolTip styling to ensure readable contrast across themes -->
<Style TargetType="ToolTip">
<Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8,6"/>
<Setter Property="HasDropShadow" Value="True"/>
</Style>
<Style TargetType="TabControl">
<Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style TargetType="TabItem">
<!-- Unselected appearance -->
<Setter Property="Background" Value="{DynamicResource HeaderBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="Margin" Value="0,0,2,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,1,1,0"
CornerRadius="3,3,0,0"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
TextBlock.Foreground="{TemplateBinding Foreground}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100"/>
<!-- Selected tab uses highlight surface color (light grey in dark mode) -->
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextForegroundBrush}"/>
</Trigger>
<!-- Hover highlight only for UNSELECTED tabs -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<!-- Blue highlight on rollover for unselected tabs -->
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SelectionBackgroundBrush}"/>
<Setter Property="Foreground" Value="White"/>
</MultiTrigger>
<!-- Slightly de-emphasize unselected tabs -->
<Trigger Property="IsSelected" Value="False">
<Setter Property="Opacity" Value="0.9"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>