ContextMenu Style is missing

Jun 18, 2011 at 3:43 PM
Edited Jun 18, 2011 at 3:44 PM

Hi there,

It seems that the style definition for the contextmenu is missing - at least in the ExpressionDark Theme.

To solve this, add the following xaml style definition in the ExpressionDark/Themes.xaml:

 <Style TargetType="{x:Type ContextMenu}">
        <Setter Property="SnapsToDevicePixels"
            Value="True" />
        <Setter Property="OverridesDefaultStyle"
            Value="True" />
        <Setter Property="Grid.IsSharedSizeScope"
            Value="true" />
        <Setter Property="HasDropShadow"
            Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">

                    <Border x:Name="Border" Background="{StaticResource MenuPopupBrush}" BorderThickness="1">
                        <Border.BorderBrush>
                            <SolidColorBrush Color="{StaticResource BorderMediumColor}" />
                        </Border.BorderBrush>
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="Border" Property="Padding" Value="0,3,0,3" />
                            <Setter TargetName="Border" Property="CornerRadius" Value="4" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 

Best

IsNull

Jul 22, 2014 at 6:19 PM
Signed in to drop a quick FYI. This helped me today when needing to update my expressiondark.xaml to support Context Menus. Thank you random internet stranger. You made my day.