Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Closed Unassigned: Support for ICustomTypeProvider [22043]

$
0
0
I think ICustomTypeProvider is newer than ICustomTypeDescriptor and easier to implement Dynamic Properties.

As a suggestion, a very little modification could enable the support of it:

protected static List<PropertyDescriptor> GetPropertyDescriptors(object instance)
{
PropertyDescriptorCollection descriptors;

TypeConverter tc = TypeDescriptor.GetConverter(instance);
if (tc == null || !tc.GetPropertiesSupported())
{
if (instance is ICustomTypeDescriptor)
{
descriptors = ((ICustomTypeDescriptor)instance).GetProperties();
}
else if (instance is ICustomTypeProvider)
{
descriptors = TypeDescriptor.GetProperties(((ICustomTypeProvider)instance).GetCustomType());
}
else
{
descriptors = TypeDescriptor.GetProperties(instance.GetType());
}
}
else
{
descriptors = tc.GetProperties(instance);
}

return (descriptors != null)
? descriptors.Cast<PropertyDescriptor>().ToList()
: null;
}
Comments: Dupplicate of 22045

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>