|
|
@@ -0,0 +1,140 @@
|
|
|
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
|
+ <!--标题栏样式-->
|
|
|
+ <Style x:Key="DataGrid.ColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
|
|
|
+ <Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
+ <Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
|
|
+ <Setter Property="FontFamily" Value="{DynamicResource FontFamily.Global}"/>
|
|
|
+ <Setter Property="FontSize" Value="{DynamicResource FontSize.Title}" />
|
|
|
+ <Setter Property="Cursor" Value="Hand" />
|
|
|
+ <Setter Property="Background" Value="{DynamicResource Brush.TextContrast}"/>
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
+ <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->
|
|
|
+ <!--<Setter Property="HorizontalAlignment" Value="Center"/>-->
|
|
|
+ <Setter Property="VerticalAlignment" Value="Center" />
|
|
|
+ <Setter Property="BorderBrush" Value="Transparent"/>
|
|
|
+ <Setter Property="BorderThickness" Value="0"/>
|
|
|
+ <Setter Property="Margin" Value="5"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
|
|
|
+ <Border x:Name="BackgroundBorder"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ Background="{TemplateBinding Background}">
|
|
|
+ <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
+ Content="{TemplateBinding Content}"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style>
|
|
|
+ <!--行样式触发-->
|
|
|
+ <Style x:Key="DataGrid.Row" TargetType="{x:Type DataGridRow}">
|
|
|
+ <!--<Setter Property="Height" Value="30"/>-->
|
|
|
+ <Setter Property="Focusable" Value="True"/>
|
|
|
+ <Setter Property="FontFamily" Value="{DynamicResource FontFamily.Global}"/>
|
|
|
+ <Setter Property="FontSize" Value="{DynamicResource FontSize.Body}"/>
|
|
|
+ <Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
|
|
+ <Style.Triggers>
|
|
|
+ <!--隔行换色-->
|
|
|
+ <Trigger Property="AlternationIndex" Value="0" >
|
|
|
+ <Setter Property="Background" Value="{DynamicResource Brush.PreviewBackground}" />
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="AlternationIndex" Value="1" >
|
|
|
+ <Setter Property="Background" Value="#343434" />
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="{DynamicResource Brush.Neutral}"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ <!--单元格样式触发-->
|
|
|
+ <Style x:Key="DataGrid.Cell" TargetType="{x:Type DataGridCell}">
|
|
|
+ <Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Stretch"/>
|
|
|
+ <Setter Property="VerticalAlignment" Value="Stretch"/>
|
|
|
+ <Setter Property="BorderThickness" Value="0"/>
|
|
|
+ <Setter Property="BorderBrush" Value="Transparent"/>
|
|
|
+ <Setter Property="Background" Value="Transparent"/>
|
|
|
+ <Setter Property="FontSize" Value="{DynamicResource FontSize.Body}"/>
|
|
|
+ <Setter Property="Margin" Value="0 5 0 5"/>
|
|
|
+ <Setter Property="Focusable" Value="True"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="{x:Type DataGridCell}">
|
|
|
+ <Border Background="{TemplateBinding Background}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Stretch">
|
|
|
+ <ContentPresenter HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Stretch"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsSelected" Value="True">
|
|
|
+ <Setter Property="Foreground" Value="{DynamicResource Brush.SelectionSelected}"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <ControlTemplate x:Key="Template.DataGrid" TargetType="{x:Type DataGrid}">
|
|
|
+ <Border BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ Background="{TemplateBinding Background}">
|
|
|
+ <Grid>
|
|
|
+ <Grid.RowDefinitions>
|
|
|
+ <RowDefinition Height="Auto"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ </Grid.RowDefinitions>
|
|
|
+ <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
|
|
|
+ Grid.Row="0"
|
|
|
+ Visibility="Visible"/>
|
|
|
+ <ScrollViewer Grid.Row="1"
|
|
|
+ x:Name="PART_ScrollViewer"
|
|
|
+ Style="{DynamicResource ScrollViewer.Default}">
|
|
|
+ <ItemsPresenter/>
|
|
|
+ </ScrollViewer>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ <!--主要DataGrid-->
|
|
|
+ <Style x:Key="DataGrid.Primary" TargetType="{x:Type DataGrid}">
|
|
|
+ <!--网格线颜色-->
|
|
|
+ <Setter Property="Background" Value="{DynamicResource Brush.TextContrast}" />
|
|
|
+ <Setter Property="Foreground" Value="{DynamicResource Brush.TextInactive}"/>
|
|
|
+ <Setter Property="HorizontalGridLinesBrush" Value="Transparent"/>
|
|
|
+ <Setter Property="VerticalGridLinesBrush" Value="Transparent"/>
|
|
|
+ <Setter Property="SnapsToDevicePixels" Value="True"/>
|
|
|
+ <Setter Property="RowHeaderWidth" Value="0"/>
|
|
|
+ <Setter Property="AlternatingRowBackground" Value="#343434"/>
|
|
|
+ <Setter Property="CanUserAddRows" Value="False"/>
|
|
|
+ <Setter Property="CanUserDeleteRows" Value="False"/>
|
|
|
+ <Setter Property="CanUserResizeColumns" Value="True"/>
|
|
|
+ <Setter Property="CanUserResizeRows" Value="False"/>
|
|
|
+ <Setter Property="CanUserSortColumns" Value="False"/>
|
|
|
+ <Setter Property="AutoGenerateColumns" Value="False"/>
|
|
|
+ <Setter Property="ColumnHeaderStyle" Value="{DynamicResource DataGrid.ColumnHeader}"/>
|
|
|
+ <Setter Property="RowStyle" Value="{DynamicResource DataGrid.Row}"/>
|
|
|
+ <Setter Property="CellStyle" Value="{DynamicResource DataGrid.Cell}"/>
|
|
|
+ <Setter Property="Template" Value="{DynamicResource Template.DataGrid}"/>
|
|
|
+ <Setter Property="SelectionUnit" Value="FullRow"/>
|
|
|
+ </Style>
|
|
|
+ <!--DataGrid编辑文本框-->
|
|
|
+ <Style x:Key="DataGrid.EditingTextBox" TargetType="{x:Type TextBox}">
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Stretch"/>
|
|
|
+ <Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
|
+ <Setter Property="VerticalAlignment" Value="Stretch"/>
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
+ <Setter Property="BorderThickness" Value="0"/>
|
|
|
+ <Setter Property="Background" Value="{DynamicResource Brush.Background}"/>
|
|
|
+ <!--<Setter Property="Width" Value="auto"/>-->
|
|
|
+ <Setter Property="Height" Value="30"/>
|
|
|
+ <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
|
|
|
+ </Style>
|
|
|
+</ResourceDictionary>
|