1
+ <ResourceDictionary xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2
+ xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
3
+ xmlns : theme =" clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" >
4
+
5
+ <Style x : Key =" {x:Type ContextMenu}"
6
+ TargetType =" {x:Type ContextMenu}" >
7
+ <Setter Property =" Background"
8
+ Value =" {DynamicResource ContextMenu.Static.Background}" />
9
+ <Setter Property =" FontFamily"
10
+ Value =" {DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}" />
11
+ <Setter Property =" FontSize"
12
+ Value =" {DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}" />
13
+ <Setter Property =" FontStyle"
14
+ Value =" {DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}" />
15
+ <Setter Property =" FontWeight"
16
+ Value =" {DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}" />
17
+ <Setter Property =" Foreground"
18
+ Value =" {DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
19
+ <Setter Property =" VerticalContentAlignment"
20
+ Value =" Center" />
21
+ <Setter Property =" BorderThickness"
22
+ Value =" 1" />
23
+ <Setter Property =" BorderBrush"
24
+ Value =" {DynamicResource ContextMenu.Static.BorderBrush}" />
25
+ <Setter Property =" Padding"
26
+ Value =" 2" />
27
+ <Setter Property =" Grid.IsSharedSizeScope"
28
+ Value =" true" />
29
+ <Setter Property =" HasDropShadow"
30
+ Value =" {DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
31
+ <Setter Property =" ScrollViewer.PanningMode"
32
+ Value =" Both" />
33
+ <Setter Property =" Stylus.IsFlicksEnabled"
34
+ Value =" False" />
35
+ <Setter Property =" Template" >
36
+ <Setter .Value>
37
+ <ControlTemplate TargetType =" {x:Type ContextMenu}" >
38
+ <theme : SystemDropShadowChrome Name =" Shdw"
39
+ Color =" Transparent"
40
+ SnapsToDevicePixels =" true" >
41
+ <Border Name =" ContextMenuBorder" Background =" {TemplateBinding Background}"
42
+ BorderBrush =" {TemplateBinding BorderBrush}"
43
+ BorderThickness =" {TemplateBinding BorderThickness}" >
44
+ <ScrollViewer Name =" ContextMenuScrollViewer"
45
+ Grid.ColumnSpan=" 2" Margin =" 1,0"
46
+ Style =" {DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}" >
47
+ <Grid RenderOptions.ClearTypeHint=" Enabled" >
48
+ <Canvas Height =" 0" Width =" 0" HorizontalAlignment =" Left" VerticalAlignment =" Top" >
49
+ <Rectangle
50
+ Name =" OpaqueRect"
51
+ Height =" {Binding ElementName=ContextMenuBorder,Path=ActualHeight}"
52
+ Width =" {Binding ElementName=ContextMenuBorder,Path=ActualWidth}"
53
+ Fill =" {Binding ElementName=ContextMenuBorder,Path=Background}" />
54
+ </Canvas >
55
+ <Rectangle Fill =" {DynamicResource ContextMenu.Header.Background}"
56
+ HorizontalAlignment =" Left"
57
+ Width =" 28"
58
+ Margin =" 1,2"
59
+ RadiusX =" 2"
60
+ RadiusY =" 2" />
61
+ <Rectangle HorizontalAlignment =" Left"
62
+ Width =" 1"
63
+ Margin =" 29,2,0,2"
64
+ Fill =" {DynamicResource ContextMenu.Header.LeftBorderBrush}" />
65
+ <Rectangle HorizontalAlignment =" Left"
66
+ Width =" 1"
67
+ Margin =" 30,2,0,2"
68
+ Fill =" {DynamicResource ContextMenu.Header.RightBorderBrush}" />
69
+ <ItemsPresenter Name =" ItemsPresenter" Margin =" {TemplateBinding Padding}"
70
+ KeyboardNavigation.DirectionalNavigation=" Cycle"
71
+ SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}" />
72
+ </Grid >
73
+ </ScrollViewer >
74
+ </Border >
75
+ </theme : SystemDropShadowChrome >
76
+ <ControlTemplate .Triggers>
77
+ <Trigger Property =" HasDropShadow"
78
+ Value =" true" >
79
+ <Setter TargetName =" Shdw"
80
+ Property =" Margin"
81
+ Value =" 0,0,5,5" />
82
+ <Setter TargetName =" Shdw"
83
+ Property =" Color"
84
+ Value =" #71000000" />
85
+ </Trigger >
86
+ <Trigger SourceName =" ContextMenuScrollViewer"
87
+ Property =" ScrollViewer.CanContentScroll"
88
+ Value =" false" >
89
+ <Setter TargetName =" OpaqueRect"
90
+ Property =" Canvas.Top"
91
+ Value =" {Binding ElementName=ContextMenuScrollViewer, Path=VerticalOffset}" />
92
+ <Setter TargetName =" OpaqueRect"
93
+ Property =" Canvas.Left"
94
+ Value =" {Binding ElementName=ContextMenuScrollViewer, Path=HorizontalOffset}" />
95
+ </Trigger >
96
+ </ControlTemplate .Triggers>
97
+ </ControlTemplate >
98
+ </Setter .Value>
99
+ </Setter >
100
+ </Style >
101
+
102
+ </ResourceDictionary >
0 commit comments