<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Fluent="clr-namespace:Fluent">

    <ControlTemplate x:Key="GalleryGroupContainerTemplate"
                     TargetType="{x:Type Fluent:GalleryGroupContainer}">
        <DockPanel LastChildFill="True">
            <Grid DockPanel.Dock="Top"
                  Height="21"
                  x:Name="headerGrid"
                  Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryGroupContainer.Header.Background}"
                  VerticalAlignment="Top">
                <TextBlock Margin="7,0"
                           Text="{TemplateBinding Header}"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Left"
                           FontWeight="Bold"
                           TextWrapping="NoWrap"
                           TextTrimming="CharacterEllipsis" />
            </Grid>

            <Fluent:UniformGridWithItemSize IsItemsHost="True"
                                            HorizontalAlignment="Left"
                                            Orientation="{TemplateBinding Orientation}"
                                            MinColumns="{TemplateBinding MinItemsInRow}"
                                            MaxColumns="{TemplateBinding MaxItemsInRow}"
                                            ItemWidth="{TemplateBinding ItemWidth}"
                                            ItemHeight="{TemplateBinding ItemHeight}" />
        </DockPanel>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHeadered"
                     Value="False">
                <Setter TargetName="headerGrid"
                        Property="Visibility"
                        Value="Collapsed" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="GalleryGroupContainerStyle"
           TargetType="{x:Type Fluent:GalleryGroupContainer}">
        <Setter Property="Template"
                Value="{DynamicResource GalleryGroupContainerTemplate}" />
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="Focusable"
                Value="False" />
        <Style.Triggers>
            <Trigger Property="IsHeadered"
                     Value="False">
                <Setter Property="HorizontalAlignment"
                        Value="Left" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>