<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:ModernWpf.Markup"
    xmlns:local="clr-namespace:ModernWpf.Controls"
    xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives">

    <Thickness x:Key="MenuFlyoutScrollerMargin">0,4,0,4</Thickness>

    <Style x:Key="ContextMenuStyleBase" TargetType="ContextMenu">
        <Setter Property="Background" Value="{DynamicResource MenuFlyoutPresenterBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource MenuFlyoutPresenterBorderBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource MenuFlyoutPresenterBorderThemeThickness}" />
        <Setter Property="Padding" Value="{DynamicResource MenuFlyoutPresenterThemePadding}" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="Grid.IsSharedSizeScope" Value="true" />
        <Setter Property="HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
        <!--<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />-->
        <!--<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />-->
        <!--<Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly" />-->
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="MaxWidth" Value="{DynamicResource FlyoutThemeMaxWidth}" />
        <Setter Property="MinHeight" Value="{DynamicResource MenuFlyoutThemeMinHeight}" />
        <Setter Property="primitives:ControlHelper.CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContextMenu">
                    <primitives:ThemeShadowChrome
                        x:Name="Shdw"
                        IsShadowEnabled="{TemplateBinding HasDropShadow}"
                        CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}"
                        SnapsToDevicePixels="True">
                        <Border
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}">
                            <ScrollViewer
                                x:Name="ContextMenuScrollViewer"
                                Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}"
                                Margin="{TemplateBinding Padding}"
                                MinWidth="{DynamicResource FlyoutThemeMinWidth}">
                                <ItemsPresenter
                                    RenderOptions.ClearTypeHint="Enabled"
                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </ScrollViewer>
                        </Border>
                    </primitives:ThemeShadowChrome>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DefaultContextMenuStyle" TargetType="ContextMenu" BasedOn="{StaticResource ContextMenuStyleBase}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
    </Style>

    <Style TargetType="ContextMenu" BasedOn="{StaticResource DefaultContextMenuStyle}" />

    <m:TextContextMenu x:Key="TextControlContextMenu" x:Shared="False" />

</ResourceDictionary>