PropertyDescriptor does not use TypeConverter in GetValue method

Grids for WPF Forum

Posted 12 years ago by George
Version: 11.2.0553


I have implemented a TypeConverter for my combobox to be used in a propertygrid and overriden GetStandardValues and the Convert methods. However, the convert method is not called when I call propertyDescriptor.GetValue(component).

I also cannot access the PropertyDataAccessor even though the call to GetValue originated from it. Is there a way to make to make the selected item appear in the combobox? What method do I need to call such that the conversion is done before I get the value?


Comments (1)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi George,

The PropertyDescriptor exposes the associated TypeConverter via it's Converter property, but calls to GetValue/SetValue do not automatically convert any values for you. You would have to get the TypeConverter and manually call into it to do any conversion.

There is no relationship from a PropertyDescriptor to one of our IPropertyDataAccessors. The PropertyDescriptor is completely independent of our PropertyGrid and it's abstraction layer. However, our PropertyDescriptorDataAccessor (which implements IPropertyDataAccessor) does have a reference to the associated PropertyDescriptor, which is exposed via the PropertyDescriptor property.

We have a Custom TypeConverter QuickStart that shows how you can leverage custom TypeConverters that are associated with properties and not types (i.e. the TypeConverterAttribute is on the property definition, not the type definition).  If that doesn't help please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.