在FullRow选择模式下禁用DataGrid当前单元格边框 [英] Disable DataGrid current cell border in FullRow selection mode

查看:96
本文介绍了在FullRow选择模式下禁用DataGrid当前单元格边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在行选择模式下使用DataGrid(即 SelectionUnit = FullRow )。我只是想删除当用户突出显示一行时在当前单元格周围放置的边框,以便具有真正的完整行选择(而没有单元格级别选择)。我不介意网格保持当前单元格的概念,我只想通过更改当前单元格的样式来删除讨厌的当前单元格边界。最简单的方法是什么?

I am using a DataGrid in row selection mode (i.e., SelectionUnit="FullRow"). I simply want to remove the border that is being placed around the current cell when the user highlights a row in order to have true full row selection (and no cell level selection). I don't mind the notion of the grid maintaining the current cell, I just want to remove that pesky current cell border, perhaps by changing the style of the current cell. What is the easiest way to do this?

推荐答案

您可以设置 BorderThickness 用于 DataGridCell 到0

<DataGrid ...
          SelectionUnit="FullRow">
    <DataGrid.CellStyle>
        <Style TargetType="DataGridCell">
            <Setter Property="BorderThickness" Value="0"/>
            <!-- Update from comments.
                 Remove the focus indication for the selected cell -->
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        </Style>
    </DataGrid.CellStyle>
    <!-- ... -->
</DataGrid>

这篇关于在FullRow选择模式下禁用DataGrid当前单元格边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆