我正在 WPF 中创建一个数据网格,以在表中显示数据库中的值。我正在努力让它看起来很漂亮,目前我正朝着我想要的方向走在正确的道路上。尽管如此,我想删除左侧可以看到的线条(图中以红色标记)。
我的 XAML 代码是(在 C# 中我没有应用任何特殊样式):
<Window x:Class="_4913_TV.ShowDBTable"
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:local="clr-namespace:_4913_TV"
mc:Ignorable="d"
WindowState="Maximized"
WindowStyle="None"
Title="ShowDBTable"
Cursor="None"
Width="4096"
Height="2160"
KeyDown="KeyedKey">
<Window.Resources>
<!-- DataGrid style -->
<Style x:Key="DataGridStyle1"
TargetType="{x:Type DataGrid}">
<Setter Property="ColumnHeaderStyle"
Value="{DynamicResource ColumnHeaderStyle1}" />
</Style>
<!-- DataGridColumnHeader style -->
<Style x:Key="ColumnHeaderStyle1"
TargetType="DataGridColumnHeader">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
<Border BorderBrush="Black"
Background="Black"
BorderThickness="5"
CornerRadius="20 20 0 0">
<TextBlock Text="{TemplateBinding Content}"
Margin="0 10 0 10"
Foreground="White"
FontSize="35"
FontWeight="Bold"
FontFamily="IBM Plex Sans"
TextAlignment="Center"
HorizontalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid>
<DataGrid Name="showTable"
Style="{DynamicResource DataGridStyle1}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="IBM Plex Sans"
FontSize="35"
RowHeight="60"
BorderBrush="White"
GridLinesVisibility="None"
AlternatingRowBackground="WhiteSmoke"
Height="auto"
Width="auto"
IsReadOnly="True"
TextBlock.TextAlignment="Center"
AutoGenerateColumns="true">
</DataGrid>
</Grid>
</Grid>
提前致谢)
你的意思是女巫边界吗?