kostey2204 kostey2204 - 7 months ago 64
C# Question

How to set grid lines in a one pixel width (WPF DataGrid)?

I am using the WPF datagrid to display some data and I want to grid lines thickness was equal to one pixel, but each cell displays unwanted border. How to get rid of it and set thickness of all lines to one pixel (like in DataGridView in WinForms)?

<DataGrid HeadersVisibility="Column" SelectionUnit="Cell">
<DataGridTextColumn Header="ID" Binding="{Binding ID}"/>
<DataGridTextColumn Header="Description" Binding="{Binding Description}"/>

unwanted borders


This is the solution! Settig parameter RenderOptions.EdgeMode="Aliased" Many thanks to David Kossoglyad for this solution.

<DataGrid RenderOptions.EdgeMode="Aliased" UseLayoutRounding="True" ....>