<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI;assembly="
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <System:Double x:Key="A_Double_GridMenuItem_Height">50</System:Double>
    <System:Double x:Key="A_Double_GridMenuItem_Width">348</System:Double>
    <System:Double x:Key="A_Double_GridMenuItem_HeightWithMargin">54</System:Double>
    <System:Double x:Key="A_Double_GridMenuItem_WidthWithMargin">352</System:Double>

    <Style x:Key="A_Style_FZMaterial_GridMenuEmptyItem"
                   TargetType="{x:Type local:FZMaterial}"
                   BasedOn="{StaticResource A_Style_FZMaterial_TextMenuEmptyItem}">
        <Setter Property="Color" Value="{StaticResource A_Color_GlassPanel_Interactive}"/>
        <Setter Property="Height" Value="{StaticResource A_Double_GridMenuItem_Height}"/>
        <Setter Property="Width" Value="{StaticResource A_Double_GridMenuItem_Width}"/>
        <Setter Property="Margin" Value="0,0,5,0"/>
    </Style>

    <Style x:Key="A_Style_ListBoxItem_GridMenu_Default"
                   BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_Default}"
                   TargetType="{x:Type ListBoxItem}">
        <Setter Property="Visibility"
                        Value="Visible" />
        <Setter Property="Width"
                        Value="{StaticResource A_Double_GridMenuItem_Width}" />
        <Setter Property="Height"
                        Value="{StaticResource A_Double_GridMenuItem_Height}" />
        <Setter
            Property="FocusSelf.WhenTrue"
            Value="{Binding (Selector.IsSelected), RelativeSource={RelativeSource Self}}" />
        <Setter
            Property="local:FocusOnMouseOverBehaviour.Self"
            Value="True" />
    </Style>

    <local:LinearTransformConverter Scale="0.25"
                                    CeilOutput="True"
                                    x:Key="A_GridRowCountFromItemCountConverter" />

    <local:LinearTransformConverter Scale="{StaticResource A_Double_GridMenuItem_HeightWithMargin}"
                                    x:Key="A_GridHeightFromRowCountConverter" />

    <local:MultiConverter x:Key="A_Converter_GridMenu_ItemCount_to_ListHeight">
        <local:MultiConverterEntry Converter="{StaticResource A_GridRowCountFromItemCountConverter}"/>
        <local:MultiConverterEntry Converter="{StaticResource A_GridHeightFromRowCountConverter}"/>
    </local:MultiConverter>

    <Style x:Key="A_Style_FZTextBlock_GridMenuItemText"
          TargetType="{x:Type local:FZTextBlock}">
          <Setter Property="HorizontalAlignment" Value="Center"/>
          <Setter Property="VerticalAlignment" Value="Center"/>
          <Setter Property="TextAlignment" Value="Center"/>
          <Setter Property="Margin" Value="0"/>
          <Setter Property="FontFamily" Value="Anthem_A"/>
          <Setter Property="CapHeight" Value="16"/>
          <Setter Property="IsHitTestVisible" Value="false"/>
          <Setter Property="Color" Value="{StaticResource H_Color_Primary_Black}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
                <Setter Property="Color" Value="{StaticResource A_Color_ListItemText_Focused}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <DataTemplate x:Key="A_DataTemplate_ListBoxItem_GridMenuItem">
        <local:FZTextBlock Text="{Binding Text}"
                    Style="{StaticResource A_Style_FZTextBlock_GridMenuItemText}"/>
    </DataTemplate>

 <local:MappingConverter x:Key="A_Converter_ToolActionToIcon">
         <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.ChangePosition}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_move.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.ChangeColor}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_change_colour.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Cut}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_cut.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Paste}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_paste.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Copy}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_copy.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.FlipHorz}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_flip_h.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.FlipVert}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_flip_v.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.CreateMaskFromLayers}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_mask.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Delete}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_delete.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.CreateLayersFromMask}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_mask.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.PlaceGroup}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_place_group.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.PlaceMask}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_change_shape.png"/> 
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.ChangeShape}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_change_shape.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Mirror}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_mirror_to_from.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.SaveGroup}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_save.png"/>
        
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledPaste}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_paste.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledMirror}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_mirror_to_from.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeColor}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_change_colour.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipHorz}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_flip_h.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipVert}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_flip_v.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFromLayers}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_mask.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeShape}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_change_shape.png"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledGroup}" Value="/ForzaUI;component/Textures/Anthem/Paintshop/tool_save.png"/>
 </local:MappingConverter>

    <System:Double x:Key="A_Double_GridMenuIconItem_Height">128</System:Double>
    <System:Double x:Key="A_Double_GridMenuIconItem_Width">128</System:Double>
    <System:Double x:Key="A_Double_GridMenuIconTextItem_Width">392</System:Double>
    <System:Double x:Key="A_Double_GridMenuIconTextItem_Height">44</System:Double>
    <System:Double x:Key="A_Double_GridMenuItemIcon_HeightWithMargin">130</System:Double>

 	<local:MappingConverter x:Key="A_Converter_GridIconWidth" Default="{StaticResource A_Double_GridMenuIconItem_Width}" >
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.SelectAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Width}"/> 
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DeleteAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Width}"/> 
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.UnselectAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Width}"/>
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Group}" Value="{StaticResource A_Double_GridMenuIconTextItem_Width}"/>
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Ungroup}" Value="{StaticResource A_Double_GridMenuIconTextItem_Width}"/>
    
  </local:MappingConverter>

	<local:MappingConverter x:Key="A_Converter_GridIconHeight"  Default="{StaticResource A_Double_GridMenuIconItem_Height}" >
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.SelectAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Height}"/> 
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DeleteAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Height}"/> 
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.UnselectAllLayers}" Value="{StaticResource A_Double_GridMenuIconTextItem_Height}"/>
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Group}" Value="{StaticResource A_Double_GridMenuIconTextItem_Height}"/>
            <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.Ungroup}" Value="{StaticResource A_Double_GridMenuIconTextItem_Height}"/>
  </local:MappingConverter>


    <Style x:Key="Style_GridIconBackground" BasedOn="{StaticResource A_Style_FZMaterial_RaiseFocusItemBackground}"
       TargetType="local:FZMaterial">
    </Style>

  <Style x:Key="Style_GridIconBackgroundDisabled"
           TargetType="local:FZMaterial">
        <Setter Property="Visibility" Value="Visible" />
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
        <Setter Property="Opacity" Value="0.4"/>
  </Style>

    <Style
        x:Key="H_Style_IconTile_Icon"
        TargetType="{Type FZMaterial}">
        <Setter
            Property="Width"
            Value="52" />
        <Setter
            Property="Height"
            Value="52" />
        <Setter
            Property="HorizontalAlignment"
            Value="Center" />
        <Setter
            Property="VerticalAlignment"
            Value="Center" />
        <Setter
            Property="Visibility"
            Value="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={FZBooleanToVisibilityConverter UseHidden=True}}" />
        <Setter
            Property="Color"
            Value="{StaticResource H_Color_Primary_Black}" />
        <Style.Triggers>
            <DataTrigger
                Binding="{Binding (TileMenuNavigationManager.LockState), RelativeSource={RelativeSource AncestorType=ContentControl}}"
                Value="{x:Static LockState.Locked}">
                <Setter
                    Property="IsEnabled"
                    Value="False"/>
            </DataTrigger>
            <Trigger
                Property="IsEnabled"
                Value="False">
                <Setter
                    Property="Color"
                    Value="{StaticResource H_Color_Primary_White}" />
                <Setter
                    Property="Opacity"
                    Value="0.6" />
                <Setter
                    Property="ImageSourceNoPreload"
                    Value="Textures\Data_Bound\PauseMenu_Icons\Lock_Icon.png" />
            </Trigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding IsInitialized, RelativeSource={RelativeSource AncestorType=Page}}" Value="True"/>
                    <Condition Binding="{Binding Icon, Converter={TypeCompareConverter}, ConverterParameter={Type ImageSource}}" Value="True"/>
                </MultiDataTrigger.Conditions>
                <Setter
                    Property="ImageSource"
                    Value="{Binding Icon}" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding IsInitialized, RelativeSource={RelativeSource AncestorType=Page}}" Value="True"/>
                    <Condition Binding="{Binding Icon, Converter={TypeCompareConverter}, ConverterParameter={Type String}}" Value="True"/>
                </MultiDataTrigger.Conditions>
                <Setter
                    Property="ImageSourceNoPreload"
                    Value="{Binding Icon}" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition
                        Binding="{Binding IsInitialized, RelativeSource={RelativeSource AncestorType=Page}}"
                        Value="True"/>
                    <Condition
                        Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
                        Value="False" />
                    <Condition
                        Binding="{Binding LockedIcon, Converter={StringVisConverter}}"
                        Value="{Static Visibility.Visible}" />
                </MultiDataTrigger.Conditions>
                <Setter
                    Property="ImageSourceNoPreload"
                    Value="{Binding LockedIcon}" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

  <Style x:Key="Style_GridIconButton"
         TargetType="local:FZMaterial"
         BasedOn="{StaticResource H_Style_IconTile_Icon}" >
  </Style>

  <Style x:Key="Style_GridIconButtonDisabled"
         TargetType="local:FZMaterial"
         BasedOn="{StaticResource H_Style_IconTile_Icon}" >
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Black}"/>
    </Style>

  <local:MappingConverter x:Key="A_Converter_GridIconBackground"  Default="{StaticResource Style_GridIconBackground}">
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledMirror}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipHorz}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipVert}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledPaste}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeColor}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledPlaceMask}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeShape}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFromLayers}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledGroup}" Value="{StaticResource Style_GridIconBackgroundDisabled}"/>
  </local:MappingConverter>

  <local:MappingConverter x:Key="A_Converter_GridIconButton"  Default="{StaticResource Style_GridIconButton}">
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledMirror}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipHorz}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFlipVert}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledPaste}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeColor}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledPlaceMask}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledChangeShape}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledFromLayers}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
    <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.DisabledGroup}" Value="{StaticResource Style_GridIconButtonDisabled}"/>
  </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_TextCheckboxVisible" Default="Collapsed">
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.SelectAllLayers}" Value="Visible"/>
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.UnselectAllLayers}" Value="Visible"/>
        
        
    </local:MappingConverter>
    
    <local:MappingConverter x:Key="A_Converter_TextCheckVisible" Default="Collapsed">
        <local:MappingConverterEntry Key="{x:Static local:LayerCommandEnum.UnselectAllLayers}" Value="Visible"/>
    </local:MappingConverter>


    <Style x:Key="A_Style_ListBoxItem_GridMenu_Icon"
           BasedOn="{StaticResource H_Style_ContentControl_Carousel_ContainerStyle}"
           TargetType="{x:Type ListBoxItem}">
        <Style.Resources>
            <CornerRadius x:Key="A_StrokeHighlight_ContentRadius">1</CornerRadius>
        </Style.Resources>
        <Setter Property="FocusOnMouseOverBehaviour.Self" Value="True" />
      <Setter Property="Visibility" Value="Visible" />
      <Setter Property="Width" Value="{Binding Value, Converter={StaticResource A_Converter_GridIconWidth}}"/> 
      <Setter Property="Height" Value="{Binding Value, Converter={StaticResource A_Converter_GridIconHeight}}"/> 
      <Setter Property="Margin" Value="2,2,2,2"/>
    <Setter Property="DynamicData.Data">
      <Setter.Value>
        <DynamicDataSource>
          <DynamicDataItem Name="ItemBackgroundStyle" DataType="Style" Value= "{Binding Value, Converter={StaticResource A_Converter_GridIconBackground}}"/> 
      </DynamicDataSource>
      </Setter.Value>
    </Setter>
   </Style>
   
    <Style x:Key="Style_GridIcon"
            TargetType="{Type FZButton}"
            BasedOn="{StaticResource H_Style_Tile}" >
        <Setter
            Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                        <FZMaterial x:Name="ButtonIcon"
                                    Preset="{StaticResource H_Roundtangle_Outer_3px}"
                                    Height="77" 
                                    Width="77"
                                    Style= "{Binding DataContext.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource A_Converter_GridIconButton}}" >
                        </FZMaterial>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style> 

    <DataTemplate x:Key="PART_A_DataTemplate_ListBoxItem_GridMenuItem_Icon">
      <local:FZButton x:Name="TextIcon"
                      Style="{StaticResource Style_GridIcon}"
                      FocusOnMouseOverBehaviour.Self="True">
                         <FZButton.DataContext>
                                <TileMenuDataItem Icon="{Binding DataContext.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource A_Converter_ToolActionToIcon}}"/>
                        </FZButton.DataContext>
     </local:FZButton>
    </DataTemplate> 
  
    <DataTemplate x:Key="PART_A_DataTemplate_ListBoxItem_GridMenuItem_Text">
      <Grid> 
        <local:FZTextBlock Text="{Binding Text}"
                           HorizontalAlignment="Left"
                           DockPanel.Dock="Left"
                           VerticalAlignment="Center"
                           FontFamily="Anthem_A"
                           CapHeight="16"
                           Color="{StaticResource H_Color_Primary_Black}"
                           Margin="10,0,50,0"/>
            <local:FZMaterial HorizontalAlignment="Right"
                              Margin="0,0,10,0"
                              Color ="{StaticResource H_Color_Primary_Black}" 
                              Visibility="{Binding DataContext.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource A_Converter_TextCheckboxVisible}}"
                              Width= "26" 
                              Height="26">
                <FZMaterial.Preset>
                    <FZMaterialPresetRoundtangleStroke CornerRadius="1" Thickness="3" />
                </FZMaterial.Preset>
                <local:FZMaterial Width="26" 
                                  Height="26" 
                                  Color="{StaticResource H_Color_Primary_Black}"                       
                                  Visibility="{Binding DataContext.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource A_Converter_TextCheckVisible}}"
                                  ImageSource="\Textures\Data_Bound\Checkbox\Tick_Icon.png"/>
            </local:FZMaterial>


        </Grid >
    </DataTemplate>

     <local:GridIconTemplateSelector x:Key="A_DataTemplateSelector_GridIconTemplateSelector" /> 
    <Style x:Key="A_Style_ListBox_Grid_Icon_Menu"
                BasedOn="{StaticResource A_Style_ListBox_TextMenu}"
                TargetType="{x:Type local:GridListBox}">
        <Style.Resources>
            <CornerRadius x:Key="A_CornerRadius_Dynamic_CarouselTile">0</CornerRadius>
        </Style.Resources>
        <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_GridMenu_Icon}"/>
        <Setter Property="MaxHeight" Value="800"/>
        <Setter Property="AllowMouseWheelScrolling" Value="False"/>
        <Setter Property="MinHeight" Value="{StaticResource A_Double_GridMenuItemIcon_HeightWithMargin}"/>
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Contained"/>
        <Setter Property="FocusManager.IsFocusScope" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Grid Margin="6,6,6,6"> 
 
                            <WrapPanel Orientation="Horizontal"
                                IsItemsHost="True"
                                Focusable="False"
                                Margin="0,0,0,0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- <Style
        TargetType="{Type ListBoxItem}"
        x:Key="A_Style_ListBoxItem_GridPopup">
        <Setter
            Property="Template"
            Value="{StaticResource A_ControlTemplate_Stat}" />
        <Setter
            Property="FocusSelf.WhenTrue"
            Value="{Binding (Selector.IsSelected), RelativeSource={RelativeSource Self}}" />
        <Setter
            Property="local:FocusOnMouseOverBehaviour.Self"
            Value="True" />
    </Style> -->

    <Style x:Key="A_Style_ListBox_GridMenu"
                BasedOn="{StaticResource A_Style_ListBox_TextMenu}"
                TargetType="{x:Type local:GridListBox}">

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Grid>
                        <StackPanel x:Name="EmptyItemsContainer"
                                    VerticalAlignment="Bottom"
                                    Orientation="Horizontal"
                                    Margin="0,0,0,5">
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GridMenuEmptyItem}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GridMenuEmptyItem}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GridMenuEmptyItem}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GridMenuEmptyItem}"/>
                        </StackPanel>
                        <local:FZScrollViewer Style="{StaticResource A_Style_ScrollViewer_TextMenu}"
                                              Template="{StaticResource A_ControlTemplate_ScrollViewer_Popup_ExternalRightPosition}"
                                              CanContentScroll="True"
                                              HorizontalScrollBarVisibility="Disabled"
                                              VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}"
                                              local:FZScrollViewer.IsAtTop="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:FZScrollViewer.IsAtTop), Mode=OneWayToSource}"
                                              local:FZScrollViewer.IsAtBottom="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:FZScrollViewer.IsAtBottom), Mode=OneWayToSource}"
                                              Focusable="False"
                                              KeepSelectionOnScreen="True"
                                              VerticalAlignment="Top"
                                              x:Name="ScrollViewer"
                                              Margin="-18,0"
                                              HandleDirectionalInput="False"
                                              >
                            <WrapPanel Orientation="Horizontal"
                                IsItemsHost="True"
                                ItemWidth="{StaticResource A_Double_GridMenuItem_WidthWithMargin}"
                                ItemHeight="{StaticResource A_Double_GridMenuItem_HeightWithMargin}"
                                Focusable="False"
                                Margin="18,0"/>
                        </local:FZScrollViewer>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding ComputedVerticalScrollBarVisibility, ElementName=ScrollViewer}" Value="{x:Static Visibility.Visible}">
                            <Setter Property="Margin" TargetName="EmptyItemsContainer" Value="1.5,0,0,0"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="A_Style_ListBoxItem_EmptyItemStyle_GridMenu"
           TargetType="ListBoxItem">
        <Setter
            Property="Focusable"
            Value="False"/>
        <Setter Property="Margin"
                Value="2,0,0,0" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="Control">
                    <FZMaterial
                        Style="{StaticResource A_Style_FZMaterial_GridMenuEmptyItem}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate
        x:Key="H_ControlTemplate_Carousel_GridMenu"
        TargetType="{Type WrapListBox}">
        <Grid 
            Margin="-60">
            <Grid
                MotionBlurEffect.MotionBlurPositionXControl="{Binding (BindingProxy.A), ElementName=VirtualizingWrapPanel}"
                MotionBlurEffect.MotionBlurPositionYControl="{Binding (BindingProxy.B), ElementName=VirtualizingWrapPanel}"
                ClipToBounds="True"
                x:Name="MotionBlur">
                <Grid.Effect>
                    <MotionBlurEffect />
                </Grid.Effect>
                <Decorator
                    Margin="40"
                    ClipToBounds="True">
                    <Grid
                        Margin="20"
                        ClipToBounds="True"
                        x:Name="ScrollClipper">
                        <VirtualizingWrapPanel
                            MinHeight= "{StaticResource A_Double_GridMenuItem_HeightWithMargin}"
                            FocusManager.IsFocusScope= "True"
                            IsItemsHost="True"
                            KeyboardNavigation.DirectionalNavigation="Contained"
                            OverrideAcrossNavigation="{TemplateBinding OverrideAcrossNavigation}"
                            ScrollOrientation="{TemplateBinding ScrollOrientation}"
                            Margin="0"
                            Style="{StaticResource H_VirtualizingWrapPanel_Default}"
                            EmptyItemStyle="{TemplateBinding EmptyItemStyle}"
                            SeparatorItemStyle="{StaticResource A_Style_Separator_CarouselItem}"
                            BlendValue.ShouldSkipInitialInputChange="True"
                            BlendValue.BlendFromPreviousOutput="True"
                            SelectionLimitTop="{TemplateBinding SelectionLimitTop}"
                            SelectionLimitBottom="{TemplateBinding SelectionLimitBottom}"
                            ScrollWindowMin="{Binding ScrollWindowMin, Mode=OneWayToSource, RelativeSource={RelativeSource TemplatedParent}}"
                            ScrollWindowMax="{Binding ScrollWindowMax, Mode=OneWayToSource, RelativeSource={RelativeSource TemplatedParent}}"
                            ScrollWindowSize="{Binding ScrollWindowSize, Mode=OneWayToSource, RelativeSource={RelativeSource TemplatedParent}}"
                            ScrollWindowValue="{Binding ScrollWindowValue, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                            x:Name="VirtualizingWrapPanel" />
                    </Grid>
                </Decorator>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger
                Binding="{Binding (MaxValue.Result), ElementName=VirtualizingWrapPanel}"
                Value="0">
                <Setter
                    Property="Effect"
                    TargetName="MotionBlur"
                    Value="{Null}" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

</ResourceDictionary>
