kostey2204 kostey2204 - 1 year ago 152
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

Answer Source

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

<DataGrid RenderOptions.EdgeMode="Aliased" UseLayoutRounding="True" ....>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download