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

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.CheckBox.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter" />

    <Style x:Key="MetroDataGridCheckBox"
           BasedOn="{StaticResource MetroCheckBox}"
           TargetType="CheckBox">
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsReadOnly, RelativeSource={RelativeSource AncestorType=DataGridCell}}" Value="True">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="IsHitTestVisible" Value="False" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=IsEditing, RelativeSource={RelativeSource AncestorType=DataGridCell}}" Value="False">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="IsHitTestVisible" Value="False" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{ComponentResourceKey ResourceId=MetroDataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle x:Name="Border" Fill="{DynamicResource GrayBrush7}" />
                        <Polygon x:Name="Arrow"
                                 Margin="8 8 3 3"
                                 HorizontalAlignment="Right"
                                 VerticalAlignment="Bottom"
                                 Fill="{DynamicResource GrayBrush1}"
                                 Opacity="0.15"
                                 Points="0,10 10,10 10,0"
                                 Stretch="Uniform" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="Fill" Value="{DynamicResource AccentColorBrush2}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Arrow" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Background" Value="{DynamicResource GrayBrush5}" />
        <Setter Property="Cursor" Value="SizeWE" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Margin="{TemplateBinding Padding}"
                            Background="Transparent"
                            BorderBrush="{TemplateBinding Background}"
                            BorderThickness="0 0 1 0"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Width" Value="8" />
    </Style>

    <Style x:Key="MetroRowHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Background" Value="{DynamicResource GrayBrush5}" />
        <Setter Property="Cursor" Value="SizeNS" />
        <Setter Property="Height" Value="6" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Margin="{TemplateBinding Padding}"
                            Background="Transparent"
                            BorderBrush="{TemplateBinding Background}"
                            BorderThickness="0 0 0 1"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroDataGridColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush5}" />
        <Setter Property="BorderThickness" Value="0 0 0 3" />
        <Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Upper" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="Padding" Value="10 4 4 7" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Border x:Name="BackgroundBorder"
                                Grid.ColumnSpan="2"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" />

                        <Controls:ContentControlEx x:Name="HeaderContent"
                                                   Padding="{TemplateBinding Padding}"
                                                   HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                   VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                   Content="{TemplateBinding Content}"
                                                   ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.ContentCharacterCasing)}"
                                                   ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                   ContentTemplate="{TemplateBinding ContentTemplate}"
                                                   ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                                   RecognizesAccessKey="True"
                                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

                        <Path x:Name="SortArrow"
                              Grid.Column="1"
                              Width="8"
                              Height="10"
                              Margin="0 0 8 2"
                              VerticalAlignment="Center"
                              Fill="{DynamicResource GrayBrush2}"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Fill"
                              Visibility="Collapsed" />

                        <Thumb x:Name="PART_LeftHeaderGripper"
                               HorizontalAlignment="Left"
                               Background="Transparent"
                               Style="{StaticResource MetroColumnHeaderGripperStyle}" />

                        <Thumb x:Name="PART_RightHeaderGripper"
                               Grid.Column="1"
                               HorizontalAlignment="Right"
                               Style="{StaticResource MetroColumnHeaderGripperStyle}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="SortDirection" Value="Ascending">
                            <Setter TargetName="SortArrow" Property="Data" Value="F1 M 34,57L 42,57L 42,32.25L 52,42.25L 52,31.75L 38,17.75L 24,31.75L 24,42.25L 34,32.25L 34,57 Z " />
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="SortDirection" Value="Descending">
                            <Setter TargetName="SortArrow" Property="Data" Value="F1 M 42,19.0002L 34,19.0002L 34,43.7502L 24,33.7502L 24,44.2502L 38,58.2502L 52,44.2502L 52,33.7502L 42,43.7502L 42,19.0002 Z " />
                            <Setter TargetName="SortArrow" Property="Margin" Value="0 0 8 0" />
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="DisplayIndex" Value="0">
                            <Setter TargetName="PART_LeftHeaderGripper" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True" />
                    <Condition Property="SortDirection" Value="{x:Null}" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource GrayBrush8}" />
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="MetroDataGridRowHeader" TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush5}" />
        <Setter Property="BorderThickness" Value="0 0 1 0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                    <Grid>
                        <Border Margin="{TemplateBinding Margin}"
                                Padding="{TemplateBinding Padding}"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                SnapsToDevicePixels="True">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  RecognizesAccessKey="True"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                <Control Grid.Column="1"
                                         Focusable="False"
                                         SnapsToDevicePixels="False"
                                         Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"
                                         Visibility="{Binding (Validation.HasError), Converter={StaticResource bool2VisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
                            </Grid>
                        </Border>
                        <Thumb x:Name="PART_TopHeaderGripper"
                               VerticalAlignment="Top"
                               Background="Transparent"
                               Style="{StaticResource MetroRowHeaderGripperStyle}" />
                        <Thumb x:Name="PART_BottomHeaderGripper"
                               VerticalAlignment="Bottom"
                               Style="{StaticResource MetroRowHeaderGripperStyle}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush3}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--  ____________________ Metro CellStyle ____________________  -->
    <Style x:Key="MetroDataGridCell" TargetType="{x:Type DataGridCell}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Controls:DataGridCellHelper.SelectionUnit" Value="{Binding Path=(Controls:DataGridRowHelper.SelectionUnit), Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ContentPresenter Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <!--  IsSelected  -->
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.HighlightTextBrush}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridCellHelper.IsCellOrRowHeader" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.HighlightBrush}" />
            </MultiTrigger>

            <!--  IsKeyboardFocusWithin  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridCellHelper.IsCellOrRowHeader" Value="True" />
                    <Condition Property="IsKeyboardFocusWithin" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.FocusBorderBrush}" />
            </MultiTrigger>

            <!--  IsSelected and Selector.IsSelectionActive  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True" />
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightTextBrush}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridCellHelper.IsCellOrRowHeader" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightBrush}" />
            </MultiTrigger>

            <!--  IsMouseOver  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridCellHelper.IsCellOrRowHeader" Value="True" />
                    <Condition Property="IsMouseOver" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.MouseOverHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.MouseOverHighlightBrush}" />
            </MultiTrigger>

            <!--  IsEnabled  -->
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </Trigger>

            <!--  IsEnabled and IsSelected  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.HighlightTextBrush}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridCellHelper.IsCellOrRowHeader" Value="True" />
                    <Condition Property="IsEnabled" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.DisabledHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.DisabledHighlightBrush}" />
            </MultiTrigger>

        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="DefaultRowValidationErrorTemplate">
        <Grid Margin="2 0 2 0"
              VerticalAlignment="Center"
              DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}, Path=(Validation.Errors).CurrentItem}"
              ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.ErrorContent}">
            <Path Width="20"
                  Height="20"
                  Data="m 31.630585,39.233818 24.6309,-24.6308 c 0.6183,-0.6184 1.6208,-0.6184 2.2392,0 l 24.6308,24.6308 c 0.6184,0.6184 0.6184,1.6209 0,2.2392 l -24.6308,24.6309 c -0.6183,0.6183 -1.6209,0.6183 -2.2392,0 l -24.6309,-24.6309 c -0.6183,-0.6183 -0.6183,-1.6208 0,-2.2392 z"
                  Fill="{DynamicResource ControlsValidationBrush}"
                  Stretch="Uniform" />
            <Path Width="10"
                  Height="10"
                  HorizontalAlignment="Center"
                  VerticalAlignment="Center"
                  Data="m 53.781741,31.196677 c -2.237724,0 -4.0625,1.824776 -4.0625,4.0625 0,2.237724 1.824776,4.0625 4.0625,4.0625 2.237724,0 4.0625,-1.824776 4.0625,-4.0625 0,-2.237724 -1.824776,-4.0625 -4.0625,-4.0625 z m -4.09375,-21.375 0.03125,0.53125 1.21875,19.46875 5.6875,0 1.25,-20 -8.1875,0 z"
                  Fill="{DynamicResource ValidationTextBrush}"
                  Stretch="Uniform" />
        </Grid>
    </ControlTemplate>

    <!--  ____________________ Metro RowStyle ____________________  -->
    <!--  Don't set the MinHeight or Height property, use the MinRowHeight or RowHeight property on DataGrid style!  -->
    <Style x:Key="MetroDataGridRow" TargetType="{x:Type DataGridRow}">
        <Setter Property="Controls:DataGridRowHelper.SelectionUnit" Value="{Binding Path=SelectionUnit, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
        <Setter Property="Margin" Value="0 0 0 0" />
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        <Setter Property="ValidationErrorTemplate" Value="{StaticResource DefaultRowValidationErrorTemplate}" />
        <Style.Triggers>
            <!--  IsSelected  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridRowHelper.SelectionUnit" Value="FullRow" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.HighlightBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.HighlightTextBrush}" />
            </MultiTrigger>

            <!--  IsSelected and Selector.IsSelectionActive  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridRowHelper.SelectionUnit" Value="FullRow" />
                    <Condition Property="IsSelected" Value="True" />
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.InactiveSelectionHighlightTextBrush}" />
            </MultiTrigger>

            <!--  IsMouseOver  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridRowHelper.SelectionUnit" Value="FullRow" />
                    <Condition Property="IsMouseOver" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.MouseOverHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.MouseOverHighlightBrush}" />
            </MultiTrigger>

            <!--  IsEnabled  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridRowHelper.SelectionUnit" Value="FullRow" />
                    <Condition Property="IsEnabled" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </MultiTrigger>

            <!--  IsEnabled and IsSelected  -->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Controls:DataGridRowHelper.SelectionUnit" Value="FullRow" />
                    <Condition Property="IsEnabled" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource MetroDataGrid.DisabledHighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource MetroDataGrid.DisabledHighlightBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource MetroDataGrid.HighlightTextBrush}" />
            </MultiTrigger>

        </Style.Triggers>
    </Style>

    <Style x:Key="MetroDataGrid" TargetType="{x:Type DataGrid}">
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
        <Setter Property="BorderThickness" Value="0 0 0 0" />
        <Setter Property="CellStyle" Value="{StaticResource MetroDataGridCell}" />
        <Setter Property="ColumnHeaderStyle" Value="{StaticResource MetroDataGridColumnHeader}" />
        <Setter Property="DropLocationIndicatorStyle">
            <Setter.Value>
                <Style TargetType="Separator">
                    <Setter Property="Background" Value="{DynamicResource GrayBrush7}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Separator">
                                <Rectangle Width="{TemplateBinding Width}"
                                           Height="{TemplateBinding Height}"
                                           Fill="{TemplateBinding Background}" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Width" Value="2" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="GridLinesVisibility" Value="None" />
        <Setter Property="HeadersVisibility" Value="Column" />
        <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource GrayBrush7}" />
        <Setter Property="MinRowHeight" Value="25" />
        <Setter Property="RowHeaderStyle" Value="{StaticResource MetroDataGridRowHeader}" />
        <Setter Property="RowStyle" Value="{StaticResource MetroDataGridRow}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGrid}">
                    <Border Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="DG_ScrollViewer" Focusable="False">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Button Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                                Command="{x:Static DataGrid.SelectAllCommand}"
                                                Focusable="False"
                                                Style="{DynamicResource {ComponentResourceKey ResourceId=MetroDataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}"
                                                Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                        <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
                                                                        Grid.Column="1"
                                                                        Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                        <Grid Grid.Row="1" Grid.ColumnSpan="2">
                                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
                                                                    Grid.ColumnSpan="2"
                                                                    CanContentScroll="{TemplateBinding CanContentScroll}" />
                                        </Grid>
                                        <ScrollBar x:Name="PART_VerticalScrollBar"
                                                   Grid.Row="1"
                                                   Grid.Column="2"
                                                   Maximum="{TemplateBinding ScrollableHeight}"
                                                   Orientation="Vertical"
                                                   ViewportSize="{TemplateBinding ViewportHeight}"
                                                   Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                                   Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                                        <Grid Grid.Row="2" Grid.Column="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar x:Name="PART_HorizontalScrollBar"
                                                       Grid.Column="1"
                                                       Maximum="{TemplateBinding ScrollableWidth}"
                                                       Orientation="Horizontal"
                                                       ViewportSize="{TemplateBinding ViewportWidth}"
                                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                                       Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource GrayBrush7}" />
        <Style.Triggers>
            <Trigger Property="IsGrouping" Value="True">
                <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="AzureDataGridColumnHeader"
           BasedOn="{StaticResource MetroDataGridColumnHeader}"
           TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Margin" Value="0 0 0 10" />
    </Style>

    <Style x:Key="AzureDataGridRowHeader"
           BasedOn="{StaticResource MetroDataGridRowHeader}"
           TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="BorderThickness" Value="0" />
    </Style>

    <!--  ____________________ Azure CellStyle ____________________  -->
    <Style x:Key="AzureDataGridCell"
           BasedOn="{StaticResource MetroDataGridCell}"
           TargetType="{x:Type DataGridCell}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ContentPresenter Margin="1"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Column.DisplayIndex}" Value="0">
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush4}" />
            </DataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Column.DisplayIndex}" Value="0" />
                    <Condition Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsSelected}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush2}" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

    <!--  ____________________ Azure RowStyle ____________________  -->
    <Style x:Key="AzureDataGridRow"
           BasedOn="{StaticResource MetroDataGridRow}"
           TargetType="{x:Type DataGridRow}" />
    <Style x:Key="AzureDataGridRowWithMargin"
           BasedOn="{StaticResource AzureDataGridRow}"
           TargetType="{x:Type DataGridRow}">
        <Setter Property="Margin" Value="0 0 0 1" />
    </Style>

    <Style x:Key="AzureDataGrid"
           BasedOn="{StaticResource MetroDataGrid}"
           TargetType="{x:Type DataGrid}">
        <Setter Property="CellStyle" Value="{StaticResource AzureDataGridCell}" />
        <Setter Property="ColumnHeaderStyle" Value="{StaticResource AzureDataGridColumnHeader}" />
        <Setter Property="RowHeaderStyle" Value="{StaticResource AzureDataGridRowHeader}" />
        <Setter Property="RowStyle" Value="{StaticResource AzureDataGridRow}" />
        <Style.Triggers>
            <Trigger Property="GridLinesVisibility" Value="None">
                <Setter Property="RowStyle" Value="{StaticResource AzureDataGridRowWithMargin}" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>