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

    <!--DataGrid样式-->
    <Style TargetType="{x:Type DataGrid}" x:Key="DefaultDataGridStyle">
        <!--<Setter Property="ColumnHeaderStyle" Value="{StaticResource DefaultDataGridColumnHeaderStyle}" />-->
        <!--<Setter Property="RowHeaderStyle" Value="{StaticResource DefaultDataGridRowHeaderStyle}" />-->
        <!--<Setter Property="CellStyle" Value="{StaticResource DefaultDataGridCell}" />-->
        <!--<Setter Property="RowStyle" Value="{StaticResource DefaultDataGridRow}" />-->
        <!--网格线颜色-->
        <Setter Property="CanUserResizeColumns" Value="false"/>
        <Setter Property="AlternationCount" Value="2"/>
        <Setter Property="Foreground" Value="#4D4E4F"/>
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="BorderBrush" Value="#C5D5DE" />
        <Setter Property="AutoGenerateColumns" Value="False" />
        <Setter Property="CanUserSortColumns" Value="False" />
        <Setter Property="CanUserAddRows" Value="False"/>
        <Setter Property="HeadersVisibility" Value="Column"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="HorizontalGridLinesBrush">
            <Setter.Value>
                <SolidColorBrush Color="#C5D5DE"/>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalGridLinesBrush">
            <Setter.Value>
                <SolidColorBrush Color="#C5D5DE"/>
            </Setter.Value>
        </Setter>
    </Style>

    <!--标题栏样式-->
    <Style TargetType="{x:Type DataGridColumnHeader}" x:Key="DefaultDataGridColumnHeaderStyle">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="MinHeight" Value="28" />
        <Setter Property="Foreground" Value="#FFFFFF" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DataGridColumnHeader">
                    <Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" 
                             BorderBrush="#e6dbba" Background="#4C8FB6"
                              Width="Auto">
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <ContentPresenter  Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"  Grid.Column="2" Width="8" Height="6" Fill="#4C8FB6" Margin="0,0,50,0" 
                            VerticalAlignment="Center" RenderTransformOrigin="1,1" />
                            <Rectangle Width="1" Fill="#d6c79b" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Height" Value="40"/>
    </Style>
    <!--行样式触发-->
    <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
    <Style TargetType="{x:Type DataGridRow}"  x:Key="DefaultDataGridRow" >
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="Height" Value="30"/>
        <Setter Property="Foreground" Value="#4D4E4F" />
        <Style.Triggers>
            <!--隔行换色-->
            <Trigger Property="AlternationIndex" Value="0" >
                <Setter Property="Background" Value="#FFFFFF" />
            </Trigger>
            <Trigger Property="AlternationIndex" Value="1" >                
                <Setter Property="Background"  Value="#2C4C8FB6" />
            </Trigger>

            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#4C8FB6"/>
                <Setter Property="Foreground" Value="#FFFFFF"/>
            </Trigger>

            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--单元格样式触发-->
    <Style TargetType="{x:Type DataGridCell}"  x:Key="DefaultDataGridCell" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DataGridCell">
                    <TextBlock TextAlignment="Center" VerticalAlignment="Center"  >
                           <ContentPresenter />
                    </TextBlock>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
</ResourceDictionary>