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;
We are reverting header color to InactiveBorder in the default windows theme in the next release of the .Net Framework, which most likely will be included in the Windows 10 Fall Creators Update. The reason this change was introduced, was that the foreground and background colors were not contrasting enough in one of the High Contrast themes, this is why we are reverting to the previously used color only in the default theme. For your reference, internal work item number, that will be also mentioned in release notes for .Net Framework 4.7.1, is 407249.
Thank you, Tanya
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With