I have a DataGrid which I am binding to a PagedCollectionView which is grouped and sorted. The contents of the DataGrid are not editable although one column contains a clickable link.
I have restricted the SelectionMode of the DataGrid to DataGridSelectionMode.Single which stops multiple row selection which is good. But the selected row also has a selected Cell which draws in a slightly lighter colour than the rest of the selected row and has a border.
Basically I’d like to have a SelectedRow but not a SelectedCell (from a UI/Display perspective).
It feels like it should be simple matter of setting a property, but I get the feeling maybe I have to edit the DataGrids template and/or mess with the VisualStateManager.
I’m happy to switch to another control other than DataGrid but I do need to be able to display Grouping.
I found ‘a’ way of making the individual cells appear to be not selected, although I’m not sure if its the best way.
Edit the CellStyle for the DataGrid, Find the Rectangle named FocusVisual. This is the Rectangle thats used to indicate a selected Cell. Set its Fill & Stroke to Transparent, I also set its StrokeThickness to 0. Don’t delete the Rectangle entirely because other things are expecting it to be there.
The xaml looked something like this:
and you add the CellStyle to the DataGrid