I\'ve tried setting border style as suggested here Disable DataGrid current cell border in FullRow selection mode, but it doesn\'t do the thing fully. Is disables cell borde
You can set Focusable to False.
<DataGrid ...
SelectionUnit="FullRow">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Focusable" Value="False"/>
</Style>
</DataGrid.CellStyle>
<!-- ... -->
</DataGrid>
Note that if you make DataGridCell.Focusable false then navigation in the datagrid with up/down arrow keys won't work.
the dashed box you see is the cell's FocusedVisualStyle
you need to override it so that it is blank.
2 options here (one of them has to be the right one but as I didn't have time to try, I don't know which)
this means you have to set it through the CellStyle
property:
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
</DataGrid.CellStyle>
or if you want to comply with MS's templating guidelines:
<DataGrid.Resources>
<!--CellFocusVisual-->
<Style x:Key="CellFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Rectangle StrokeThickness="0" Stroke="#00000000" StrokeDashArray="1 2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{StaticResource CellFocusVisual}"/>
</Style>
</DataGrid.CellStyle>
(this way, you can see how it is done)
ElementStyle
or the EditingElementStyle
this is more of a hasle there, because the ElementStyle
and EditingElementStyle
are defined on the Column, wich means you have to edit each column's ElementStyle
and EditingElementStyle
.
but basically, this is the same thing: you set up the FocusVisualStyle to null or the style defined above through the ElementStyle
and/or EditingElementStyle
on each Column