Removing all DataGrid row and cell borders

C#.NetWpfXamlDatagrid

C# Problem Overview


I want to hide (or remove) all the borders of all the rows (and subsequently cells) in my datagrid, think a basic HTML table. I've looked all over and most questions seem to be about styling them and not hiding them.

I've already tried setting the BorderBrush and BorderThickness like so:

 <DataGrid.RowStyle>
     <Style TargetType="DataGridRow">
         <Setter Property="BorderBrush" Value="Transparent" />
         <Setter Property="BorderThickness" Value="0" />
     </Style>
  </DataGrid.RowStyle>

Tried the same for the CellStyle, but no dice, still seeing borders.

C# Solutions


Solution 1 - C#

What about setting GridLinesVisibility="None"?

<DataGrid GridLinesVisibility="None">
    ...
<DataGrid>

Solution 2 - C#

You could also do it this way

 dataGrid.GridLinesVisibility = DataGridGridLinesVisibility.None;

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondiggingforfireView Question on Stackoverflow
Solution 1 - C#Adi LesterView Answer on Stackoverflow
Solution 2 - C#Ramgy BorjaView Answer on Stackoverflow