<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:smart="clr-namespace:SmartUI.Controls">
    <Style x:Key="MenuStyle" TargetType="Menu">
        <Setter Property="Background" Value="Transparent"/>
    </Style>
    <Style TargetType="Menu" BasedOn="{StaticResource MenuStyle}"/>
    <Style TargetType="MenuItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="FontSize" Value="{x:Static SystemFonts.CaptionFontSize}"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="MenuItem">
                    <DockPanel x:Name="dock" Background="Transparent" LastChildFill="True" Cursor="Hand" FocusVisualStyle="{x:Null}">
                        <Border x:Name="border" Background="{TemplateBinding BorderBrush}" Width="{TemplateBinding Width}" Height="2" DockPanel.Dock="Bottom"/>
                        <smart:PackIcon x:Name="pack" DockPanel.Dock="Right" Kind="KeyboardArrowRight" Width="16" Height="16"/>
                        <DockPanel LastChildFill="True" HorizontalAlignment="Left" Margin="10 0">
                            <ContentPresenter x:Name="icon" DockPanel.Dock="Left" Content="{TemplateBinding Icon}" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
                            <Label  x:Name="contont" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentStringFormat="{TemplateBinding HeaderStringFormat}"/>
                            <!--<ContentPresenter x:Name="contont" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="2" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>-->
                            <Popup Placement="Right" x:Name="SubMenuPopup" AllowsTransparency="True" PlacementTarget="{Binding ElementName=dock}"  Focusable="False" IsOpen="{TemplateBinding IsSubmenuOpen}" >
                                <Border Background="White" Name="SubmenuBorder" BorderBrush="LightGray" Margin="8" BorderThickness="1" SnapsToDevicePixels="True"  >
                                    <Border.Effect>
                                        <DropShadowEffect Color="LightGray" Opacity="0.3" Direction="8" ShadowDepth="3"/>
                                    </Border.Effect>
                                    <ScrollViewer  ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                                    </ScrollViewer>
                                </Border>
                            </Popup>
                        </DockPanel>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Icon" Value="{x:Null}">
                            <Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <!--<Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
                        </Trigger>-->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="True"/>
                                <Condition Property="Role" Value="TopLevelHeader"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
                            <Setter TargetName="contont" Property="FontWeight" Value="Black"/>
                        </MultiTrigger>
                        <Trigger Property="Role" Value="TopLevelHeader">
                            <Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom"/>
                            <Setter TargetName="SubMenuPopup" Property="VerticalOffset" Value="3"/>
                            <Setter TargetName="pack" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="Role" Value="TopLevelItem">
                            <Setter TargetName="pack" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="Role" Value="SubmenuItem">
                            <Setter TargetName="dock" Property="MinWidth" Value="120"/>
                            <Setter TargetName="pack" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="Role" Value="SubmenuHeader">
                            <Setter TargetName="dock" Property="MinWidth" Value="120"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>