Italic text in PropertyGrid

I use a PropertyGrid to display custom properties that are displayed through the implementation of ICustomTypeDescriptor.

My objects are configured in a tree structure, and the values ​​for each property are either specified in each object or inherited from the parent objects. In the PropertyGrid, I want to visually show the user which property values ​​are set in the selected object and which are inherited from the parent objects.

Now I show each property two categories. One set shows what value is specified in the actual object, with an empty field if it is not set. Another set shows property values ​​assigned to an object that are either specified in the object or inherited if they are not set in the object.

I would like to combine these two groups into one purchase, showing the properties of the set in plain text and the inherited values ​​in italic text. However, there seems to be no way to do this through ICustomTypeDescriptor.GetProperties (). And I do not have easy access to the PropertyGrid properties, as they are created while the program is running.

+3
source share
1 answer

You cannot make italics, but you can make bold; fatty behavior is determined PropertyDescriptor ShouldSerializeValue; You can wrap PropertyDescriptorusing various tricks System.ComponentModel( ICustomTypeDescriptor, TypeConverteror TypeDescriptionProvider) and provide your own PropertyDescriptor.

, VisualHint - . " " .

+3

Source: https://habr.com/ru/post/1706345/


All Articles