Custom Gridline Color of Datagrid In WPF


In this article we will see how we can customize the Gridline color in datagrid in WPF.

Creating WPF Application

Fire up Visual Studio 2010 and create a WPF Application, name the solution as CustomDatagrid.


Add a Datagrid to the application by dragging from the toolbox to the designer.


Here are the initial settings when you add the Datagrid.

Now let’s fill in the datagrid with sample data.



Now let’s see how it looks without the Height customization.


In Datagrid we have couple of properties like HorizontalGridLinesBrush and VerticalGridLinesBrush. By default the Brushes are Black.




Let’s change the above Brushes to Blue and Red respectively.

Now run the application, and you would see the changes.



Hope this article helps.

Related Posts:

1) Making Timeline Control for DataGrid In WPF

2) Custom Row and Header Height of Datagrid In WPF

3) Rounded Corner Datagrid In WPF

4) Tooltip In DataGrid In WPF

5) Grouping In Datagrid In WPF

6) Cell Alignment In DataGrid In WPF

7) Edit Row Details In Context Menu In DataGrid In WPF

8) Hide/Un-Hide Columns Using Context Menu In DataGrid In WPF

9) Hide &Un-Hide DataGrid Column(s) In WPF

10) ComboBox In DataGrid In WPF

11) DatePicker In DataGrid In WPF

12) CRUD Operation In DataGrid In WPF