Skip to content

Commit a1abc7f

Browse files
committed
Context menu is unreadable when dark theme #142
1 parent a0651b0 commit a1abc7f

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

CodeNav.Shared/CodeNav.Shared.projitems

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<SubType>Designer</SubType>
5858
<Generator>MSBuild:Compile</Generator>
5959
</Page>
60+
<Page Include="$(MSBuildThisFileDirectory)Styles\ContextMenuStyle.xaml">
61+
<SubType>Designer</SubType>
62+
<Generator>MSBuild:Compile</Generator>
63+
</Page>
6064
<Page Include="$(MSBuildThisFileDirectory)Styles\PlusMinusExpanderStyles.xaml">
6165
<SubType>Designer</SubType>
6266
<Generator>MSBuild:Compile</Generator>

CodeNav.Shared/Menus/ItemContextMenu.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
<ResourceDictionary.MergedDictionaries>
77
<ResourceDictionary Source="../Styles/BookmarkButtonStyle.xaml"/>
8+
<ResourceDictionary Source="../Styles/ContextMenuStyle.xaml"/>
89
</ResourceDictionary.MergedDictionaries>
910

1011
<ContextMenu
1112
x:Key="ItemContextMenu"
12-
IsOpen="{Binding Path=ContextMenuIsOpen, Mode=TwoWay}">
13+
IsOpen="{Binding Path=ContextMenuIsOpen, Mode=TwoWay}"
14+
Style="{StaticResource ContextMenuStyle}">
1315

1416
<MenuItem
1517
Header="Go to Definition"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:vsShell="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0">
4+
5+
<Style x:Key="ContextMenuStyle" TargetType="{x:Type ContextMenu}">
6+
<Setter Property="Background" Value="{DynamicResource {x:Static vsShell:EnvironmentColors.DropDownPopupBackgroundBeginBrushKey}}" />
7+
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsShell:EnvironmentColors.DropDownBorderBrushKey}}" />
8+
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsShell:EnvironmentColors.ToolWindowTextBrushKey}}" />
9+
<Setter Property="Template">
10+
<Setter.Value>
11+
<ControlTemplate TargetType="{x:Type ContextMenu}">
12+
<Border Uid="Border_93">
13+
<Border.Style>
14+
<Style TargetType="{x:Type Border}">
15+
<Setter Property="Tag" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}"/>
16+
<Style.Triggers>
17+
<DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}}" Value="True">
18+
<Setter Property="Background" Value="Transparent"/>
19+
<Setter Property="Padding" Value="0,0,5,5"/>
20+
<Setter Property="Effect">
21+
<Setter.Value>
22+
<DropShadowEffect BlurRadius="4" Opacity="0.8" ShadowDepth="1"/>
23+
</Setter.Value>
24+
</Setter>
25+
</DataTrigger>
26+
</Style.Triggers>
27+
</Style>
28+
</Border.Style>
29+
<Border BorderBrush="{TemplateBinding BorderBrush}"
30+
BorderThickness="{TemplateBinding BorderThickness}"
31+
Background="{TemplateBinding Background}"
32+
Uid="Border_50">
33+
<ScrollViewer CanContentScroll="True"
34+
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
35+
TypeInTargetAssembly={x:Type FrameworkElement}}}"
36+
Uid="ScrollViewer_9">
37+
<ItemsPresenter
38+
KeyboardNavigation.DirectionalNavigation="Cycle"
39+
Margin="{TemplateBinding Padding}"
40+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
41+
Uid="ItemsPresenter_5"/>
42+
</ScrollViewer>
43+
</Border>
44+
</Border>
45+
</ControlTemplate>
46+
</Setter.Value>
47+
</Setter>
48+
</Style>
49+
</ResourceDictionary>

0 commit comments

Comments
 (0)