<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <SolidColorBrush x:Key="Listview_Header_BD" Color="Black" />
    <SolidColorBrush x:Key="Listview_Header_FG" Color="White" />
    <SolidColorBrush x:Key="Listview_Header_BG_Mouseover" Color="#FF58AAE2" />

    <SolidColorBrush x:Key="Listview_BG_Highlight" Color="#FF3399FF" />
    <SolidColorBrush x:Key="Listview_BG_First" Color="#FFEEEEEE" />
    <SolidColorBrush x:Key="Listview_BG_Second" Color="#FFDEDEDE" />
    <SolidColorBrush x:Key="Listview_Header_BG" Color="#FFA1C9F5" />

    <SolidColorBrush x:Key="Listview_Content_BD" Color="#FF999999" />

    <!--  Listview ColumnHeader ControlTemplate  -->

    <Style TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="FontFamily" Value="Arial" />
        <Setter Property="Foreground" Value="{DynamicResource FG_Black}" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Border
                        Background="Transparent"
                        BorderBrush="{DynamicResource Listview_Header_BD}"
                        BorderThickness="0,0,1,0"
                        Cursor="Hand"
                        SnapsToDevicePixels="true">
                        <Grid>
                            <Border x:Name="BG" Margin="0,1" />
                            <ContentPresenter
                                x:Name="HeaderContent"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True">
                                <!--<ContentPresenter.Effect>
                                    <DropShadowEffect BlurRadius="0" ShadowDepth="1" Direction="315"/>
                                </ContentPresenter.Effect>-->
                            </ContentPresenter>
                            <Thumb
                                x:Name="PART_HeaderGripper"
                                Width="8"
                                Margin="0,0,-4,0"
                                HorizontalAlignment="Right"
                                Style="{DynamicResource Thumb-ListViewItem}" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="BG" Property="Border.Background" Value="{DynamicResource Listview_Header_BG_Mouseover}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="OnlyGripper_GridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Grid x:Name="Grid" SnapsToDevicePixels="true">
                        <ContentPresenter
                            x:Name="OnlyGripper_HeaderContent"
                            Margin="5,0"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="Center"
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        <Thumb
                            Width="10"
                            Margin="-5,0"
                            HorizontalAlignment="Right"
                            Style="{DynamicResource Thumb-ListViewItem}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  listview Item Style  -->

    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="TextBlock.TextAlignment" Value="Left" />
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="MinWidth" Value="50" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border
                        x:Name="BG"
                        Background="{TemplateBinding Background}"
                        BorderBrush="Gray"
                        BorderThickness="0,0,0,1"
                        Cursor="Hand"
                        SnapsToDevicePixels="True">
                        <Grid>
                            <Border
                                x:Name="Highlight"
                                Background="{DynamicResource Listview_BG_Highlight}"
                                BorderBrush="Black"
                                BorderThickness="0"
                                Opacity="0" />
                            <GridViewRowPresenter Columns="{TemplateBinding GridView.ColumnCollection}" Content="{TemplateBinding Content}" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Highlight" Property="Opacity" Value="1" />
                            <Setter TargetName="Highlight" Property="BorderThickness" Value="1" />
                            <Setter Property="Foreground" Value="White" />
                            <Setter TargetName="Highlight" Property="Margin" Value="0,-1" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Highlight" Property="Opacity" Value="0.8" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="ListView.AlternationIndex" Value="0">
                <Setter Property="Background" Value="{DynamicResource Listview_BG_First}" />
            </Trigger>
            <Trigger Property="ListView.AlternationIndex" Value="1">
                <Setter Property="Background" Value="{DynamicResource Listview_BG_Second}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--  listview Style  -->

    <Style x:Key="ListView-ScrollViewer" TargetType="{x:Type ScrollViewer}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="CanContentScroll" Value="False" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid>
                            <Border
                                x:Name="TopBG"
                                MinHeight="24"
                                Background="{DynamicResource Listview_Header_BG}"
                                BorderBrush="{DynamicResource Listview_Header_BD}"
                                BorderThickness="1" />
                            <ScrollViewer
                                Focusable="False"
                                HorizontalScrollBarVisibility="Hidden"
                                VerticalScrollBarVisibility="Hidden">
                                <ScrollViewer.LayoutTransform>
                                    <TransformGroup>
                                        <ScaleTransform />
                                        <SkewTransform />
                                        <RotateTransform />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </ScrollViewer.LayoutTransform>
                                <GridViewHeaderRowPresenter
                                    AllowsColumnReorder="{Binding TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderContainerStyle="{Binding TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderContextMenu="{Binding TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderTemplate="{Binding TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderToolTip="{Binding TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
                                    Columns="{Binding TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </ScrollViewer>
                        </Grid>
                        <Grid Grid.Row="1">
                            <Border BorderBrush="{DynamicResource Listview_Content_BD}" BorderThickness="1,0,1,1">
                                <ScrollContentPresenter
                                    Name="PART_ScrollContentPresenter"
                                    CanContentScroll="{TemplateBinding CanContentScroll}"
                                    CanHorizontallyScroll="False"
                                    CanVerticallyScroll="False"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    KeyboardNavigation.DirectionalNavigation="Local" />
                            </Border>
                        </Grid>
                        <ScrollBar
                            x:Name="PART_HorizontalScrollBar"
                            Grid.Row="2"
                            Grid.Column="0"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            Minimum="0"
                            Orientation="Horizontal"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                            Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <ScrollBar
                            x:Name="PART_VerticalScrollBar"
                            Grid.Row="0"
                            Grid.RowSpan="2"
                            Grid.Column="1"
                            MinWidth="0"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            Minimum="0"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                            Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <DockPanel
                            Grid.Row="2"
                            Grid.Column="1"
                            LastChildFill="False" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Thumb-ListViewItem" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="Transparent">
                        <Rectangle
                            Width="1"
                            HorizontalAlignment="Center"
                            Opacity="1" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ListView}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <Border Name="Border">
                        <ScrollViewer Style="{DynamicResource ListView-ScrollViewer}">
                            <ItemsPresenter Grid.Row="0" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>