-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
2836 lines (2778 loc) · 219 KB
/
Copy pathMainWindow.xaml
File metadata and controls
2836 lines (2778 loc) · 219 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Window x:Class="KillerPDF.MainWindow" Icon="pack://application:,,,/Resources/kp-icon.ico"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:KillerPDF"
xmlns:ctrl="clr-namespace:KillerPDF.Controls"
mc:Ignorable="d"
Title="KillerPDF" Height="700" Width="1000" MinHeight="480" MinWidth="620"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="CanResize"
Background="{DynamicResource SurfaceBrush}"
FontFamily="{DynamicResource UiFont}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
UseLayoutRounding="True"
SnapsToDevicePixels="True">
<!-- Hardware-accelerated custom chrome. Dropping AllowsTransparency lets WPF composite the
whole window on the GPU again (the film grain + drop shadows were being software-rendered
every frame, which made dragging/animation jumpy). WindowChrome gives native drag, snap,
resize and the OS drop shadow; the title bar (row 0) becomes the caption and the
min/max/close buttons opt back into hit-testing with IsHitTestVisibleInChrome. -->
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="{DynamicResource TitleBarHeight}"
ResizeBorderThickness="8"
CornerRadius="0"
GlassFrameThickness="0"
NonClientFrameEdges="None"
UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- OutlineButton (accent outline at rest, fills solid on hover - the family standard):
the footer's Install button uses it below. Already used by the file dialog; merged
here too rather than duplicating the style, so the two never drift apart. -->
<ResourceDictionary Source="pack://application:,,,/Controls/PickerStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Brush keys come from Application.Resources (theme dicts) via DynamicResource.
Only non-color styles live here. -->
<!-- Close button's top-right corner: rounded to match the window when floating, squared
when maximized/snapped. Updated in UpdateWindowChrome alongside the frame corners. -->
<CornerRadius x:Key="ChromeCloseCorner">0,7,0,0</CornerRadius>
<!-- Shared film-grain brush for popup menus (settings/shortcuts/language/overflow).
ImageSource is assigned once in ApplyGrainTexture; every reference updates.
MUST STAY AT WINDOW SCOPE. In App.xaml it throws "Cannot set a property on ImageBrush
because it is in a read-only state" at startup: WPF freezes Freezables in
application-level dictionaries for cross-thread safety, so its ImageSource can never
be assigned from there.
PdfViewer.xaml reaches it with DynamicResource, which walks the live tree
(control -> window -> app) and finds it here perfectly well. -->
<ImageBrush x:Key="GrainBrushShared" TileMode="Tile"
ViewportUnits="Absolute" Viewport="0,0,256,256" Stretch="None"/>
<!-- Settings section subheaders: white with a faint depth shadow (the "Settings" title carries the
accent color instead). Margin stays inline per row. -->
<Style x:Key="SettingsSubheader" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" BlurRadius="3" ShadowDepth="1" Direction="270" Opacity="{DynamicResource HeaderShadowOpacity}"/>
</Setter.Value>
</Setter>
</Style>
<!-- Settings current-value labels (English, Dark, ...): accent-colored, with a depth shadow so the
accent stays legible on every theme background. -->
<Style x:Key="SettingsAccentValue" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe UI, Microsoft JhengHei UI, Nirmala UI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{DynamicResource HeaderLineBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" BlurRadius="3" ShadowDepth="1" Direction="270" Opacity="{DynamicResource HeaderShadowOpacity}"/>
</Setter.Value>
</Setter>
</Style>
<!-- Overflow menu row button -->
<Style x:Key="OverflowMenuButton" TargetType="Button">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="b" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Padding="8,5">
<ContentPresenter VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="b" Property="Background" Value="{DynamicResource PaneBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Toolbar button -->
<Style x:Key="ToolbarButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="10,6"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource ControlCornerRadius}"
Padding="{TemplateBinding Padding}"
ToolTip="{TemplateBinding ToolTip}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentPresenter.Effect>
<!-- IconShadowOpacity is 0 in Light theme, so the glyph stays crisp ClearType
there; dark themes get the soft depth shadow. -->
<DropShadowEffect Color="Black" BlurRadius="4" ShadowDepth="2" Direction="270" Opacity="{DynamicResource IconShadowOpacity}"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolbarButtonAccent" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
<Setter Property="Foreground" Value="{DynamicResource AccentLogo}"/>
</Style>
<!-- Main half of an Open/Save split button: its hover fill is inset on the right so it
stops just short of the overlapping dropdown chevron instead of running under it. -->
<Style x:Key="ToolbarSplitMain" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="bg" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource ControlCornerRadius}" Margin="0,0,7,0"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
ToolTip="{TemplateBinding ToolTip}">
<ContentPresenter.Effect>
<DropShadowEffect Color="Black" BlurRadius="4" ShadowDepth="2" Direction="270" Opacity="{DynamicResource IconShadowOpacity}"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bg" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolbarSplitMainAccent" TargetType="Button" BasedOn="{StaticResource ToolbarSplitMain}">
<Setter Property="Foreground" Value="{DynamicResource AccentLogo}"/>
</Style>
<Style x:Key="ToolbarButtonDanger" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
<Setter Property="Foreground" Value="{DynamicResource DangerRed}"/>
</Style>
<Style x:Key="ToolbarToggleButton" TargetType="ToggleButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="10,6"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource ControlCornerRadius}"
Padding="{TemplateBinding Padding}"
ToolTip="{TemplateBinding ToolTip}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentPresenter.Effect>
<DropShadowEffect Color="Black" BlurRadius="4" ShadowDepth="2" Direction="270" Opacity="{DynamicResource IconShadowOpacity}"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource SelectionBg}"/>
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource SelectionFg}"/>
<Setter Property="Foreground" Value="{DynamicResource SelectionFg}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ChromeButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource CaptionGlyphBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Width" Value="{DynamicResource CaptionButtonWidth}"/>
<Setter Property="Height" Value="{DynamicResource CaptionButtonHeight}"/>
<Setter Property="FontSize" Value="10"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontWeight" Value="{DynamicResource CaptionGlyphWeight}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="Bd" Margin="{DynamicResource CaptionButtonMargin}"
Background="{TemplateBinding Background}"/>
<Border x:Name="Face" Margin="{DynamicResource CaptionButtonMargin}"
Background="{DynamicResource CaptionButtonBrush}">
<Grid>
<Border x:Name="capLight" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelLightBrush}"
BorderThickness="{DynamicResource ButtonBevelLightThickness}"/>
<Border x:Name="capDark" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelDarkBrush}"
BorderThickness="{DynamicResource ButtonBevelDarkThickness}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
<!-- Grain OVER the hover fill (family rule). Hover-only: at rest the
face is transparent and the window's own grain already shows, so a
permanent tile here would double the texture. -->
<Border x:Name="capGrain" IsHitTestVisible="False" Visibility="Collapsed"
Background="{DynamicResource GrainTileBrush}" Opacity="{DynamicResource GrainOpacity}"/>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource CaptionHoverBrush}"/>
<Setter TargetName="capGrain" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource RowSelectedBrush}"/>
<Setter TargetName="capLight" Property="BorderBrush" Value="{DynamicResource BevelDarkBrush}"/>
<Setter TargetName="capDark" Property="BorderBrush" Value="{DynamicResource BevelLightBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ChromeCloseButton" TargetType="Button" BasedOn="{StaticResource ChromeButton}">
<Setter Property="Foreground" Value="{DynamicResource CaptionCloseBrush}"/>
<Setter Property="Margin" Value="{DynamicResource CaptionCloseGap}"/>
<Setter Property="Tag" Value="{DynamicResource ChromeCloseCorner}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="Bd" Margin="{DynamicResource CaptionButtonMargin}"
Background="{TemplateBinding Background}"
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
<Border x:Name="Face" Margin="{DynamicResource CaptionButtonMargin}"
Background="{DynamicResource CaptionButtonBrush}"
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}">
<Grid>
<Border x:Name="capLight" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelLightBrush}"
BorderThickness="{DynamicResource ButtonBevelLightThickness}"/>
<Border x:Name="capDark" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelDarkBrush}"
BorderThickness="{DynamicResource ButtonBevelDarkThickness}"/>
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="10"
FontWeight="{DynamicResource CaptionGlyphWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Visibility="{DynamicResource CaptionFontGlyphVisibility}"/>
<Grid Width="8" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center"
Visibility="{DynamicResource CaptionDrawnGlyphVisibility}">
<Rectangle Width="10" Height="2" Fill="{TemplateBinding Foreground}"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Rectangle.RenderTransform><RotateTransform Angle="45" CenterX="5" CenterY="1"/></Rectangle.RenderTransform>
</Rectangle>
<Rectangle Width="10" Height="2" Fill="{TemplateBinding Foreground}"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Rectangle.RenderTransform><RotateTransform Angle="-45" CenterX="5" CenterY="1"/></Rectangle.RenderTransform>
</Rectangle>
</Grid>
<!-- Grain OVER the hover fill, hover-only - same as ChromeButton. -->
<Border x:Name="capGrain" IsHitTestVisible="False" Visibility="Collapsed"
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"
Background="{DynamicResource GrainTileBrush}" Opacity="{DynamicResource GrainOpacity}"/>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource CaptionCloseHoverBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource CaptionCloseHoverFgBrush}"/>
<Setter TargetName="capGrain" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="capLight" Property="BorderBrush" Value="{DynamicResource BevelDarkBrush}"/>
<Setter TargetName="capDark" Property="BorderBrush" Value="{DynamicResource BevelLightBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Inset overlay close: the KillerNotes about-card geometry. Unlike the main
caption close, its hover face rounds on all four corners. -->
<Style x:Key="DialogCloseButton" TargetType="Button" BasedOn="{StaticResource ChromeCloseButton}">
<Setter Property="Tag" Value="{DynamicResource SmallCornerRadius}"/>
</Style>
<!-- Shared close for the About and shortcuts cards (KillerScan is the family reference):
a bare muted X that turns red on hover, no caption-style hover box. 98SE swaps the
glyph, font, metrics, and colors through the AboutClose* theme keys. -->
<Style x:Key="OverlayCloseButton" TargetType="Button">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Foreground" Value="{DynamicResource AboutCloseFg}"/>
<Setter Property="FontFamily" Value="{DynamicResource AboutCloseFont}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="{DynamicResource CaptionGlyphWeight}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border Background="{DynamicResource CaptionButtonBrush}"/>
<Border x:Name="bevelLight" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelLightBrush}"
BorderThickness="{DynamicResource BevelLightThickness}"/>
<Border x:Name="bevelDark" IsHitTestVisible="False"
BorderBrush="{DynamicResource BevelDarkBrush}"
BorderThickness="{DynamicResource BevelDarkThickness}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource AboutCloseHoverFg}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="bevelLight" Property="BorderBrush" Value="{DynamicResource BevelDarkBrush}"/>
<Setter TargetName="bevelDark" Property="BorderBrush" Value="{DynamicResource BevelLightBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Tab close button: themed so hover is the danger red (not WPF's default blue chrome). -->
<Style x:Key="TabCloseButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource DangerRed}"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Shared close "X" for overlay headers, recent-list rows, and the signature box. Glyph turns
danger red with a soft drop shadow on hover, and a slightly deeper shadow when pressed.
Centralised so every close X behaves identically. -->
<Style x:Key="DangerCloseButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="Cp" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource DangerRed}"/>
<Setter TargetName="Cp" Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#000000" BlurRadius="4" ShadowDepth="1" Direction="270" Opacity="0.5"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="{DynamicResource DangerRed}"/>
<Setter TargetName="Cp" Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#000000" BlurRadius="6" ShadowDepth="2" Direction="270" Opacity="0.6"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- New-tab "+" button: subtle hover, no default chrome. -->
<Style x:Key="TabNewButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Resize grip: small dotted triangle, inset from the corner so it clears the rounded
window corner. The control keeps its hit area, only the dots are pulled in. -->
<Style TargetType="ResizeGrip">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ResizeGrip">
<Grid Background="Transparent" SnapsToDevicePixels="True" Margin="0,0,5,5">
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,0"/>
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,4,0"/>
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,8,0"/>
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,4"/>
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,4,4"/>
<Rectangle Width="2" Height="2" Fill="{DynamicResource DimTextBrush}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,8"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- The themed ScrollBar style + ThumbFloor converter now live at app scope (App.xaml) so every
dialog window inherits the same scrollbar instead of the gray system default. -->
<!-- Themed slider styles (DarkSlider / DarkSliderThumb / DarkSliderRepeat) live in App.xaml:
the Transform and Stamp dialogs resolve them by DynamicResource from their own windows,
so they must be app-scoped (window-scoped copies here left those dialogs on stock chrome). -->
<!-- Dark context menu -->
<!-- Themed menu separator: a thin dim line instead of the bright default. -->
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Separator">
<Border Height="1" Margin="8,4" Background="{DynamicResource CardBorderBrush}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ============================================================
Family flyout standard (from KillerUI Controls.xaml): the rail's theme and language
flyouts are ContextMenus whose chrome comes ONLY from FlyoutCard + FlyoutGrain, with
PanelMenuItem stripping the MenuItem container for panel content. The grain tile's
ImageSource is wired in code beside the document grain brushes (Shell/ContextMenu.cs).
============================================================ -->
<!-- GrainTileBrush moved to App.xaml: the file picker (and any other standalone Window)
resolves DynamicResource against its own tree and then APPLICATION resources - a
brush declared here was invisible to it, which left the picker untextured. -->
<!-- The card: fill, frame, radius, shadow-room margin and the shadow itself. -->
<Style x:Key="FlyoutCard" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource MenuBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource MenuBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="{DynamicResource FlyoutCornerRadius}"/>
<!-- Margin is the room the drop shadow renders into: a Popup clips to its own bounds,
so anything the shadow throws past it is cut off square. Sized to the effect below,
not picked: WPF expands render bounds by the FULL BlurRadius, so a 22 blur needs 22
each way, and the 4px downward depth takes 4 off the top and adds 4 to the bottom.
CONSUMERS MUST COMPENSATE with HorizontalOffset/VerticalOffset - see the ContextMenu
style below. -->
<Setter Property="Margin" Value="22,18,22,26"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" BlurRadius="22" ShadowDepth="4" Direction="270" Opacity="{DynamicResource FlyoutShadowOpacity}"/>
</Setter.Value>
</Setter>
</Style>
<!-- The grain overlay. LAST child of the card, so it lies OVER the items - including a
highlighted row's solid SelectionBg fill. Radius 5 = the card's 6 minus its 1px
border, so the texture stops exactly inside the frame. -->
<Style x:Key="FlyoutGrain" TargetType="Border">
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Background" Value="{DynamicResource GrainTileBrush}"/>
<Setter Property="Opacity" Value="{DynamicResource GrainOpacity}"/>
</Style>
<!-- ItemContainerStyle for a flyout whose content is a PANEL (swatches, radio lists)
rather than rows you click. Strips the MenuItem container down to its content: no
hover highlight bleeding across the card, no icon gutter. -->
<Style x:Key="PanelMenuItem" TargetType="MenuItem">
<Setter Property="Padding" Value="0"/>
<!-- A click inside the panel that bubbles up to this container (the accent dots are
plain Borders, so theirs do) counts as a MenuItem click and closes the flyout
without this. The theme flyout must survive a pick so themes can be compared;
the language flyout closes itself explicitly in SelectLocale either way. -->
<Setter Property="StaysOpenOnClick" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<ContentPresenter ContentSource="Header"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ContextMenu">
<Setter Property="Background" Value="{DynamicResource MenuBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource MenuBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="{DynamicResource MenuFontFamily}"/>
<Setter Property="FontSize" Value="{DynamicResource MenuFontSize}"/>
<Setter Property="Padding" Value="0,4"/>
<Setter Property="HasDropShadow" Value="False"/>
<!-- Compensates the shadow halo so a menu lands where it did when that halo was 5 (this
template) or 6 (FlyoutCard). Those two differ by a pixel, so the rail flyouts sit
1px off their old spot; the menus are exact. -->
<Setter Property="HorizontalOffset" Value="-17"/>
<Setter Property="VerticalOffset" Value="-13"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<!-- Margin leaves room for the drop shadow to render inside the popup.
FADE IN: a ContextMenu has no PopupAnimation property - it is not a
Popup, it is hosted inside one WPF owns - so the fade is driven from
the template with an EventTrigger on Loaded. The SubPopup below already
sets PopupAnimation="Fade", so a menu appeared instantly while its own
children faded in, which is backwards. 150ms ease-out. -->
<!-- Radius 6 = the family flyout card (FlyoutCard above); the grain overlay
takes 5, the card's 6 minus its 1px border, so the texture stops exactly
inside the frame. -->
<!-- Halo sized to the 22/4 shadow below, the family flyout value: WPF expands
render bounds by the FULL BlurRadius, so 22 each way, less the 4px lift
off the top and plus it on the bottom. The offsets on the style above
hold the card in place against the wider halo. -->
<Grid x:Name="MenuRoot" Opacity="0" Margin="22,18,22,26">
<!-- Shadow-only layer behind, so the menu text stays crisp. -->
<Border Background="{TemplateBinding Background}" CornerRadius="{DynamicResource PanelCornerRadius}" IsHitTestVisible="False">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="22" ShadowDepth="4" Direction="270" Opacity="{DynamicResource FlyoutShadowOpacity}"/>
</Border.Effect>
</Border>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource PanelCornerRadius}">
<Grid>
<!-- Film grain on the menu surface, matching the settings panel. -->
<Border IsHitTestVisible="False" Opacity="{DynamicResource GrainOpacity}"
CornerRadius="{DynamicResource PanelCornerRadius}" Background="{DynamicResource GrainBrushShared}"/>
<!-- IsSharedSizeScope so every MenuItem's Header/Gesture columns in THIS
popup align as real columns (see the MenuItem template's SharedSizeGroup
names) instead of each row sizing its shortcut text independently. -->
<StackPanel IsItemsHost="True" Margin="{TemplateBinding Padding}" KeyboardNavigation.DirectionalNavigation="Cycle"
Grid.IsSharedSizeScope="True"/>
</Grid>
</Border>
<Border IsHitTestVisible="False" Margin="{DynamicResource MenuBevelInnerMargin}" BorderBrush="{DynamicResource MenuBevelLightBrush}" BorderThickness="{DynamicResource MenuBevelLightThickness}"/>
<Border IsHitTestVisible="False" Margin="{DynamicResource MenuBevelInnerMargin}" BorderBrush="{DynamicResource MenuBevelDarkBrush}" BorderThickness="{DynamicResource MenuBevelDarkThickness}"/>
<Border IsHitTestVisible="False" BorderBrush="{DynamicResource MenuBevel2LightBrush}" BorderThickness="{DynamicResource MenuBevel2LightThickness}"/>
<Border IsHitTestVisible="False" BorderBrush="{DynamicResource MenuBevel2DarkBrush}" BorderThickness="{DynamicResource MenuBevel2DarkThickness}"/>
</Grid>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="ContextMenu.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="MenuRoot" Storyboard.TargetProperty="Opacity"
From="0" To="1" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction><QuadraticEase EasingMode="EaseOut"/></DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="MenuItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}"/>
<Setter Property="FontFamily" Value="{DynamicResource MenuFontFamily}"/>
<Setter Property="FontSize" Value="{DynamicResource MenuFontSize}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="MenuBd" Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}" CornerRadius="{DynamicResource ControlCornerRadius}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<!-- Header and Gesture are Auto + SharedSizeGroup, not Header="*", so the
shortcut text starts at the SAME x-offset in every sibling row (a real
column) instead of hugging the right edge of whichever row is widest. -->
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuHeaderCol"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuGestureCol"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon slot: MenuItem.Icon renders in the same 16px gutter the check
glyph uses (MakeMenuItem's glyph parameter fills it with MDL2 icons). -->
<ContentPresenter x:Name="IconPresenter" Grid.Column="0" ContentSource="Icon"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<!-- check glyph for checkable items (e.g. OCR language multi-select) -->
<TextBlock x:Name="Check" Grid.Column="0" Text=""
FontFamily="Segoe MDL2 Assets" FontSize="11"
Foreground="{DynamicResource PrimaryBrush}"
VerticalAlignment="Center" HorizontalAlignment="Left"
Visibility="Collapsed"/>
<ContentPresenter Grid.Column="1" ContentSource="Header" VerticalAlignment="Center"/>
<TextBlock x:Name="Gesture" Grid.Column="2" Text="{TemplateBinding InputGestureText}"
Foreground="{DynamicResource MutedTextBrush}" FontSize="11"
VerticalAlignment="Center" Margin="24,0,0,0"/>
<!-- submenu arrow for items that have children -->
<TextBlock x:Name="SubArrow" Grid.Column="3" Text=""
FontFamily="Segoe MDL2 Assets" FontSize="8"
Foreground="{DynamicResource MutedTextBrush}"
VerticalAlignment="Center" Margin="12,0,0,0"
Visibility="Collapsed"/>
<Popup x:Name="SubPopup" AllowsTransparency="True" Placement="Right"
HorizontalOffset="-21" VerticalOffset="-13" Focusable="False" PopupAnimation="Fade"
IsOpen="{TemplateBinding IsSubmenuOpen}">
<!-- Mirrors the ContextMenu template surface so submenus match the parent menu.
Halo sized to the 22/4 shadow; the offsets above carry the
-17,-13 compensation (this halo grew from 5) on top of the -4 gap. -->
<Grid Margin="22,18,22,26">
<Border Background="{DynamicResource MenuBackgroundBrush}" CornerRadius="{DynamicResource FlyoutCornerRadius}" IsHitTestVisible="False">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="22" ShadowDepth="4" Direction="270" Opacity="{DynamicResource FlyoutShadowOpacity}"/>
</Border.Effect>
</Border>
<Border Background="{DynamicResource MenuBackgroundBrush}"
BorderBrush="{DynamicResource MenuBorderBrush}"
BorderThickness="1" CornerRadius="{DynamicResource FlyoutCornerRadius}" Padding="4">
<Grid>
<Border Panel.ZIndex="10" IsHitTestVisible="False" Margin="-4" BorderBrush="{DynamicResource MenuBevelLightBrush}" BorderThickness="{DynamicResource MenuBevelLightThickness}"/>
<Border Panel.ZIndex="10" IsHitTestVisible="False" Margin="-4" BorderBrush="{DynamicResource MenuBevelDarkBrush}" BorderThickness="{DynamicResource MenuBevelDarkThickness}"/>
<Border Panel.ZIndex="10" IsHitTestVisible="False" Margin="{DynamicResource MenuBevelInnerMargin}" BorderBrush="{DynamicResource MenuBevel2LightBrush}" BorderThickness="{DynamicResource MenuBevel2LightThickness}"/>
<Border Panel.ZIndex="10" IsHitTestVisible="False" Margin="{DynamicResource MenuBevelInnerMargin}" BorderBrush="{DynamicResource MenuBevel2DarkBrush}" BorderThickness="{DynamicResource MenuBevel2DarkThickness}"/>
<Border IsHitTestVisible="False" Opacity="{DynamicResource GrainOpacity}"
CornerRadius="{DynamicResource FlyoutCornerRadius}" Margin="-4" Background="{DynamicResource GrainBrushShared}"/>
<!-- Own scope, so a submenu's columns align among its own
siblings rather than the unrelated parent popup's rows. -->
<ItemsPresenter Grid.IsSharedSizeScope="True"/>
</Grid>
</Border>
</Grid>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!-- SELECTION, not a gray wash. BgHover is #404040 in every theme, so
the menu was the one place in the product where "this is the one"
rendered in neutral gray - and KillerPDF is the app the others
copy. Now the family's selected treatment: SelectionBg fill with
SelectionFg text. The gesture and chevron are recolored too, as
TextSecondary is unreadable on a saturated fill. -->
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="MenuBd" Property="Background" Value="{DynamicResource SelectionBg}"/>
<Setter Property="Foreground" Value="{DynamicResource SelectionFg}"/>
<Setter TargetName="Gesture" Property="Foreground" Value="{DynamicResource SelectionFg}"/>
<Setter TargetName="SubArrow" Property="Foreground" Value="{DynamicResource SelectionFg}"/>
<Setter TargetName="IconPresenter" Property="TextElement.Foreground" Value="{DynamicResource SelectionFg}"/>
</Trigger>
<!-- Collapse the shortcut column when there is no gesture, so items without a
shortcut do not reserve its 24px left margin as phantom right padding. -->
<Trigger Property="InputGestureText" Value="">
<Setter TargetName="Gesture" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Check" Property="Visibility" Value="Visible"/>
<Setter TargetName="IconPresenter" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Role" Value="SubmenuHeader">
<Setter TargetName="SubArrow" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="Role" Value="TopLevelHeader">
<Setter TargetName="SubArrow" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="MenuBd" Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Separator">
<Setter Property="Background" Value="{DynamicResource CardBorderBrush}"/>
<Setter Property="Height" Value="1"/>
<Setter Property="Margin" Value="4,4"/>
</Style>
<!-- Page list styles -->
<Style x:Key="PageListBox" TargetType="ListBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource CardBorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="13"/>
<!-- Set on the ItemsControl so the ListBoxItem default FindAncestor binding resolves; silences the benign "Data Error 4 ... HorizontalContentAlignment" spam during virtualization. -->
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
</Style>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="8,6"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Bd"
Background="{TemplateBinding Background}"
BorderThickness="0"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource SelectionBg}"/>
<Setter Property="Foreground" Value="{DynamicResource SelectionFg}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Sidebar tab buttons (PAGES / OUTLINES) -->
<Style x:Key="SidebarTabBtn" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="10"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="2,2,8,2"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ContentPresenter/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.35"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Dark TreeView for PDF outline/bookmarks -->
<Style x:Key="OutlineTreeStyle" TargetType="TreeView">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="12"/>
</Style>
<!-- Outline tree expander triangle: themed (muted at rest, accent on hover), rotates on expand.
Replaces the stock WPF toggle so no default-blue chrome bleeds through. -->
<Style x:Key="OutlineExpander" TargetType="ToggleButton">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="Transparent" Width="16" Height="16">
<Path x:Name="Arrow" Width="6" Height="9"
HorizontalAlignment="Center" VerticalAlignment="Center"
RenderTransformOrigin="0.5,0.5"
Data="M0,0 L5,4.5 L0,9 Z"
Fill="{DynamicResource DimTextBrush}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Outline tree row: website-style accent left-bar + tinted selection, themed hover, no WPF blue. -->
<Style x:Key="OutlineItemStyle" TargetType="TreeViewItem">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="IsExpanded" Value="False"/>
<Setter Property="Padding" Value="6,5"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header row: spans toggle + label, carries the selection fill and left accent bar.
Because it sits in row 0 only, its IsMouseOver excludes child rows (no ancestor hover). -->
<Border x:Name="Bd" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Background="Transparent" BorderBrush="Transparent"
BorderThickness="2,0,0,0" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="Expander" Grid.Column="0"
Style="{DynamicResource OutlineExpander}"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press"/>
<ContentPresenter x:Name="PART_Header" Grid.Column="1"
ContentSource="Header"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- Children indented by one toggle width -->
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
</Trigger>
<Trigger SourceName="Bd" Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource SelectionBg}"/>
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- General-purpose themed text button -->
<Style x:Key="DarkButton" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource PaneBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource CardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Opacity" Value="0.75"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Settings panel radio button -->
<!-- Clickable accent-color swatch for the Dark theme family (website-style picker).
Literal hue colors, identical across themes. The selection ring is set in code. -->
<Style x:Key="AccentDot" TargetType="Border">
<Setter Property="Width" Value="18"/>
<Setter Property="Height" Value="18"/>
<!-- Theme-driven: 9 (circle) on modern themes, 0 (square) on 98SE. -->
<Setter Property="CornerRadius" Value="{DynamicResource AccentSwatchCornerRadius}"/>
<Setter Property="Margin" Value="0,0,7,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>
<Style x:Key="ThemeRadio" TargetType="RadioButton">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="0,0,0,8"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="bd" Background="Transparent" CornerRadius="3"
Margin="-8,0,2,0" Padding="10,4,10,4">
<!-- DockPanel (not a horizontal StackPanel) so the content fills the row
width, letting a right-aligned column (e.g. language codes) reach the
right edge. -->
<DockPanel LastChildFill="True" Background="Transparent">
<Grid Width="16" Height="16" VerticalAlignment="Center" Margin="0,0,8,0" DockPanel.Dock="Left">
<Ellipse x:Name="ring" Width="14" Height="14"
Stroke="{DynamicResource DimTextBrush}" StrokeThickness="1.5"
Fill="{DynamicResource RadioWellBrush}"/>
<!-- 8, not 7: a 7px dot in the 16px cell sits at a half-pixel