Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 Creators Update changes the style of PropertyGrid control

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:

<code>PropertyGrid</code> new style

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?

like image 405
glopes Avatar asked Apr 25 '17 11:04

glopes


2 Answers

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;
like image 145
joe Avatar answered Sep 28 '22 18:09

joe


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

like image 27
Tanya Solyanik Avatar answered Sep 28 '22 17:09

Tanya Solyanik