I just upgraded some systems to Windows 10 Creators Update and I noticed that the windows forms PropertyGrid
control changed its default visual style for headers and bar margins to dark gray, like so:
And as mostly happens with unexpected visual changes, users are not happy. Is there a way to revert back to the old default or maybe override the default style?
There's a bug in PropertyGrid:
The property PropertyGrid.LineColor
has a DefaultValue
attribute Set to SystemColors.InactiveBorder
.
But the internal field lineColor
is initialized with SystemColors.ControlDark
.
This is bad, because the Windows Forms designer detects that the property has the same value as the DefaultValue
attribute, and therefore it does not write the designer code for the PropertyGrid.LineColor
property in InitializeComponent
. So at runtime, the property is initialized to SystemColors.ControlDark
.
As a quick hack, you can set the property after InitializeComponent
:
InitializeComponent();
propertyGrid.LineColor = SystemColors.InactiveBorder;