Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataGrid: How to remove black inner borders?

Tags:

wpf

I have a datagrid:

<DataGrid x:Name="gvImports" 
    HorizontalAlignment="Left" 
    AutoGenerateColumns="False" 
    Margin="10,36.816,0,0" 
    VerticalAlignment="Top" 
    Height="163.087" Width="485.05">
</DataGrid>

Then I am setting the cell border style in C#:

var cellStyle = new Style(typeof(DataGridCell));
cellStyle.Setters.Add
      (new Setter(DataGridCell.BorderBrushProperty, Brushes.Magenta));
gvImports.CellStyle = cellStyle;

Notice the offensive Magenta for demonstration purposes only.

Here is an image of the DataGrid when rendered:

enter image description here

I want to get rid of those inner black lines, any idea how this is done?

like image 447
JL. Avatar asked Feb 16 '23 20:02

JL.


2 Answers

gvImports.GridLinesVisibility = DataGridGridLinesVisibility.None; 
like image 190
JL. Avatar answered Apr 02 '23 22:04

JL.


Set the horizontal and vertical grid line brushes (HorizontalGridLinesBrush and VerticalGridLinesBrush). See here for a list of data grid styling properties.

like image 25
Tombala Avatar answered Apr 02 '23 22:04

Tombala