<UserControl x:Class="Platform.UI.Application.FE.UserControls.CaseLibraryUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Platform.UI.Application.FE.UserControls"
xmlns:conv="clr-namespace:Platform.UI.Application.FE.Converters"
xmlns:uic_conv="clr-namespace:Platform.UI.Controls.Converters;assembly=Platform.UI.Controls"
xmlns:properties="clr-namespace:Platform.UI.Application.FE.Properties"
xmlns:config="clr-namespace:Platform.Config;assembly=Platform.Config"
mc:Ignorable="d"
d:DesignHeight="768" d:DesignWidth="1024">
<UserControl.Resources>
<Style x:Key ="GDStyle" TargetType="DataGridCell">
<Setter Property="HorizontalAlignment" Value="Center">Setter>
<Setter Property ="VerticalAlignment" Value="Center">Setter>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="LightBlue"/>
Style.Resources>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="BorderBrush" Value="LightBlue"/>
<Setter Property="Background" Value="LightBlue">
Setter>
Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="LightBlue"/>
<Setter Property="BorderBrush" Value="LightBlue"/>
Trigger>
Style.Triggers>
Style>
UserControl.Resources>
<DataGrid x:Name="dataGridList" ItemsSource="{Binding PatientCaseDataTable}" AutoGenerateColumns="False" IsReadOnly="True" GridLinesVisibility="None" BorderThickness="0" FontSize="16" MouseDoubleClick="dataGridList_MouseDoubleClick">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
LinearGradientBrush>
Setter.Value>
Setter>
<Setter Property ="FontWeight" Value="Bold"/>
<Setter Property ="FontSize" Value="18"/>
<Setter Property ="HorizontalAlignment" Value="Center" />
Style>
DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="患者姓名" Width="16*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 患者姓名}"/>
<DataGridTextColumn Header="性别" Width="12*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 性别}"/>
<DataGridTextColumn Header="年龄" Width="10*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 年龄}"/>
<DataGridTextColumn Header="创建人" Width="16*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 创建人}"/>
<DataGridTextColumn Header="创建日期" Width="22*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 创建日期}"/>
<DataGridTextColumn Header="状态" Width="16*" CellStyle="{StaticResource GDStyle}" Binding="{Binding 状态}"/>
DataGrid.Columns>
DataGrid>
UserControl>
DataGrid和DataGrid.ColumnHeaderStyle和DataGridCell的 Foreground Background BorderBrush这三个属性全都设置了一遍都没有用,DataGrid设置后是表格外框变,Header是表头变,单元格设置后还是只是内容部分颜色变,而不是整个一行颜色变。
BorderThickness属性试过也不行,开头引用多但是我也没用哇
希望效果像这种中间没有留白整个一行都填满蓝色