PropertyGrid Category Problem with CustomTypeDescriptor/PropertyDescriptor

Grids for WPF Forum

Posted 1 year ago by Gergely Bacsó
Version: 17.2.0661
Avatar

Hi,

I've just changed my old WPF property grid to the Actipro version. I use CustomTypeDescriptor and custom PropertyDescriptors.
In the old version, categories worked fine, but in the new one I only have a "Misc" category for all properties (and PropertyDescriptor.Category is not even hit).

Is it a bug or am I doing something wrong?

Thank you,
Gergely

Comments (4)

Posted 1 year ago by Gergely Bacsó
Avatar

Also, custom TypeConverters don't seem to work with PropertyDescriptors. PropertyDescriptor.Converter is queried, but the converter's ConvertTo/ConvertFrom methods are never called.

--- Update1: PropertyDescriptor.Converter just begin to work while I was developing other parts of the PropertyGrid's interaction logic.
--- Update2: The problem appears when I have the gridseditors:BuiltinPropertyEditors.IsEnabled="True" setter. Note: I'm using the EnumDescriptionTypeConverter found in the samples. They don't work together.

--- Update3: as a workaround, I can remove all property editors from PropertyGrid.PropertyEditors which have an Enum PropertyType.

[Modified 1 year ago]

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gergely,

Thanks for reporting the Category issue.  It looks like an oversight, and we have updated the code for the next build 662 to call into PropertyDescriptor.Category.

As for the type converters, yes our EnumEditBox that gets applied for Enum property types with the gridseditors:BuiltinPropertyEditors.IsEnabled="True" setting will not use type converters since it builds up the items by hand.  As you saw, you can exclude the property editor for Enum that gets injected from that setting to use the default handling for Enum properties.


Actipro Software Support

Posted 1 year ago by Gergely Bacsó
Avatar

Hi,

there are some more problems regarding CustomTypeDescriptor / PropertyDescriptor that I came across:

  • PropertyDescriptor.IsReadOnly is also ignored
  • The event CustomTypeDescriptor.NotifyPropertyChanged is also ignored

Is there a way to manually make a property read-only? (Or update the read-only state, when PropertyDescriptor.IsReadOnly changes?)

Thanks

[Modified 1 year ago]

Posted 1 year ago by Gergely Bacsó
Avatar

Sorry, PropertyDescriptor.IsReadOnly and PropertyDescriptorPropertyModel.IsValueReadOnly both work fine, the bug was in my code.
I also found a workarond for refreshing properties, namely: PropertyDescriptorPropertyModel.Refresh(PropertyRefreshReason.ValueChanged)

The latest build of this product (v2018.1 build 0675) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.