删除WPF DataGrid中选定单元格内容周围的框/边框

删除WPF DataGrid中选定单元格内容周围的框/边框,wpf,xaml,datagrid,Wpf,Xaml,Datagrid,正在尝试重新设置WPF数据网格的样式。几乎是我需要的地方,除了一个特点:当选择一行时,所有单元格的内容都被白色边框包围 我不知道如何摆脱这个。目前,我的造型如下所示: <Style TargetType="{x:Type DataGridRow}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transpare

正在尝试重新设置WPF数据网格的样式。几乎是我需要的地方,除了一个特点:当选择一行时,所有单元格的内容都被白色边框包围

我不知道如何摆脱这个。目前,我的造型如下所示:

<Style TargetType="{x:Type DataGridRow}">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <Setter Property="Background" Value="#3CACDC" />
            <Setter Property="Foreground" Value="White" />
        </Trigger>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="#90C8E0" />
        </Trigger>
    </Style.Triggers>
</Style>

另外,DataGridCell具有几乎相同的样式集

目前尚不清楚该问题是否提出了相同的问题,但公认的将
FocusVisualStyle
设置为
Null
的解决方案并没有删除边框。但是,它确实会更改样式:


我怎样才能避开这个边界?

我想你可以尝试设计DataGridCell样式

   <DataGrid.CellStyle>
    <Style TargetType="DataGridCell">
        <Setter Property="BorderThickness" Value="0"/>          
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    </Style>
  </DataGrid.CellStyle>


对不起,问题打错了。我已经在单元格和行上尝试过了。请尝试在DataGrid中使用SelectionUnit=“FullRow”。除了上面发布的样式之外,还有其他样式吗?是否所有的xaml都与DataGrid相关?我不能重现这样的行为。选定的行以蓝色突出显示,选定的单元格有黑色边框。您是否找到解决方案?我也有同样的问题。正如你在评论中提到的,被接受的答案不起作用。