I have wrote some code in order to add 100 x 100 cells to a grid. The thing is that I would like to highlight the lines that split the rows/column of the grid.
What properties should I use, or how should I do that?
Bellow is the code for creating the grid cells :
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
for (int i = 0; i < 100 ; i++)
layoutGrid.RowDefinitions.Add( new RowDefinition { } );
for (int i = 0; i < 100; i++)
layoutGrid.ColumnDefinitions.Add(new ColumnDefinition { });
}
}
There's a couple ways you can try. If you take a look at Grid.cs, see the Brushes.Blue & Brushes.Yellow solid colors that make up the dashes you see when you enable ShowGridLines="True" in the source below? You can set those over to a different color (make them both the same color to not have to edit it much like Brushes.Gray, or you can omit the dash, draw a single line, and could even use a custom brush resource like a gradient.
Or there's a trick you can do shown in XAML (because I had already slapped an example together for a past post elsewhere) where you take a border control with a set BorderBrush & BorderThickness and span incremental borders across the cells & columns like this example;
Or with XAML for DataGrid;
Hope this helps and best of luck!