wenxiangchao
3 天以前 b544d5cccd76735e034c8055918a50927b437474
HMI.UI/Style/PanuonDataGrid.xaml
@@ -11,52 +11,71 @@
             xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
             xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI">
    <ResourceDictionary.MergedDictionaries>
        <pu:StyleDictionary Includes="DataGrid" />
        <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Style/ScrollBarResource.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="DefaultDataGridRow" TargetType="DataGridRow" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridRowStyle}}">
        <Setter Property="Background" Value="White"/>
        <Setter Property="DetailsVisibility" Value="Collapsed"/>
    <Style x:Key="DefaultDataGridColumnHeader" TargetType="DataGridColumnHeader">
        <Setter Property="Background" Value="{DynamicResource PrimaryColor}"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryColorContract}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource PrimaryColorContract}"/>
        <Setter Property="BorderThickness" Value="0,0,1,1"/>
    </Style>
    <Style x:Key="DefaultDataGridCell" TargetType="DataGridCell">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="5,0,0,0"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DataGridCell">
                    <Grid Background="{TemplateBinding Background}">
                        <ContentPresenter VerticalAlignment="Center"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="AlternationIndex" Value="1">
                <Setter Property="Background" Value="#eeeeee"/>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{DynamicResource PrimaryColor}"/>
                <Setter Property="Foreground" Value="{DynamicResource PrimaryColorContract}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="DataGridCell"
       BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridCellStyle}}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
    <Style x:Key="DefaultDataGridRow" TargetType="DataGridRow">
        <Setter Property="Background" Value="White"/>
        <Style.Triggers>
            <Trigger Property="AlternationIndex" Value="1">
                <Setter Property="Background" Value="#eeeeee"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource SecondPrimaryColor}"/>
                <Setter Property="Foreground" Value="{DynamicResource SecondPrimaryColorContract}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="DefaultDataGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridStyle}}">
    <Style x:Key="DefaultDataGrid" TargetType="DataGrid">
        <Style.Resources>
            <Style TargetType="DataGridColumnHeader"
       BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridColumnHeaderStyle}}">
                <Setter Property="Padding" Value="10"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollStyle_Mobile}"/>
        </Style.Resources>
        <Setter Property="CellStyle" Value="{StaticResource DefaultDataGridCell}"/>
        <Setter Property="RowHeight" Value="30"/>
        <Setter Property="ColumnHeaderHeight" Value="36"/>
        <Setter Property="ColumnHeaderStyle" Value="{StaticResource DefaultDataGridColumnHeader}"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
        <Setter Property="ForceCursor" Value="True"/>
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="RowStyle" Value="{StaticResource DefaultDataGridRow}"/>
        <Setter Property="AlternationCount" Value="2"></Setter>
        <Setter Property="Foreground" Value="#3a3a3a"/>
        <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource TableBoarder}"/>
        <Setter Property="VerticalGridLinesBrush" Value="{StaticResource TableBoarder}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TableBoarder}" />
        <Setter Property="AlternationCount" Value="2"/>
        <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource TableBoarder}"/>
        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource TableBoarder}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource TableBoarder}" />
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="CanUserAddRows" Value="False"/>
        <Setter Property="CanUserSortColumns" Value="False"/>
@@ -65,24 +84,7 @@
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="GridLinesVisibility" Value="All"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="{StaticResource CommonBoarder}"/>
        <Setter Property="FontSize" Value="{StaticResource ContentFontSize2}"/>
        <Setter Property="pu:DataGridHelper.IsVerticalScrollBarCrossingColumnHeaderPanel" Value="True"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderForeground" Value="White"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderBackground" Value="{StaticResource TableHeader}"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderHoverBackground" Value="{StaticResource TableHeader}"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderSeparatorBrush" Value="{StaticResource TableBoarder}"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderSeparatorVisibility" Value="Visible"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderVerticalContentAlignment" Value="Center"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment" Value="Left"/>
        <Setter Property="pu:DataGridHelper.RowHeaderSeparatorBrush" Value="{StaticResource CommonBoarder}"/>
        <Setter Property="pu:DataGridHelper.RowHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/>
        <Setter Property="pu:DataGridHelper.RowHoverBackground" Value="{StaticResource SecondPrimaryColor}"/>
        <Setter Property="pu:DataGridHelper.RowSelectedBackground" Value="{StaticResource PrimaryColor}"/>
        <Setter Property="pu:DataGridHelper.RowSelectedForeground" Value="White"/>
        <Setter Property="pu:DataGridHelper.RowHeaderBorderThickness" Value="10,0,0,0"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderBorderThickness" Value="0"/>
        <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
        <Setter Property="BorderBrush" Value="{DynamicResource CommonBoarder}"/>
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize2}"/>
    </Style>
</ResourceDictionary>