<Window x:Class="Aucma.Core.PrintTo.Views.HomeWindowView" 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" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Aucma.Core.PrintTo.Views" mc:Ignorable="d" Background="#F4F4F4" d:DesignHeight="1200" d:DesignWidth="800"> <Window.Resources> <!--列头标题栏样式--> <!--<Style TargetType="DataGridColumnHeader"> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="Background" Value="#dddddd"/> <Setter Property="Foreground" Value="Black"/> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="Height" Value="50"/> <Setter Property="FontSize" Value="14"/> </Style>--> <Style TargetType="DataGridColumnHeader"> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="Height" Value="30"/> </Style> <!--单元格样式--> <Style TargetType="DataGridCell"> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="FontSize" Value="12"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridCell}"> <Grid Background="{TemplateBinding Background}" > <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--<Style TargetType="TextBlock" x:Key="centerAlignmentStyle"> <Setter Property="Foreground" Value="Gray"/> <Setter Property="FontSize" Value="14"/> <Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="TextWrapping" Value="Wrap"/> </Style>--> <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式,换行换色--> <Style TargetType="DataGridRow"> <Setter Property="Height" Value="30"/> <Style.Triggers> <Trigger Property="AlternationIndex" Value="0"> <Setter Property="Background" Value="#e7e7e7" /> <!--ffe14d--> </Trigger> <Trigger Property="AlternationIndex" Value="1"> <Setter Property="Background" Value="#f2f2f2" /> <!--f1ef9f--> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="#f1ef9f" /> </Trigger> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="#05c4ff"/> </Trigger> <Trigger Property="IsFocused" Value="True"> <Setter Property="Background" Value="#05c4ff"/> </Trigger> </Style.Triggers> </Style> <!--但由于DataGridTextColumn不能从FrameworkElement或FrameworkContentElement继承而无法使用--> <!--<Style TargetType="DataGridTextColumn"> <Setter Property="ElementStyle"> <Setter.Value> <Style TargetType="TextBlock"> <Setter Property="VerticalAlignment" Value="Center"/> </Style> </Setter.Value> </Setter> </Style>--> <!--网格线颜色--> <Style TargetType="DataGrid"> <!--该属性指示是否允许用户调整列宽度--> <Setter Property="CanUserResizeColumns" Value="false" /> <Setter Property="Background" Value="#F4F4F4" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="SelectionUnit" Value="FullRow" /> <Setter Property="VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="HorizontalScrollBarVisibility" Value="Auto" /> <Setter Property="RowHeaderWidth" Value="0" /> <Setter Property="HorizontalGridLinesBrush"> <Setter.Value> <SolidColorBrush Color="#d6c79b" /> </Setter.Value> </Setter> <Setter Property="VerticalGridLinesBrush"> <Setter.Value> <SolidColorBrush Color="#d6c79b" /> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid > </Grid> </Window>