TypeConverter for a UserControl

G

Guest

I am working on a custom DataGridColumnStyle that can host a UserControl. I
have created a public property on this ColumnStyle of type MyUserControlBase.
I would like to be able to set this property in the PropertyGrid by choosing
from a list of UserControls that inherit from MyUserControlBase.

Using a TypeConverter that inherits from TypeList Converter, I have been
able to get the property to show up in the PropertyGrid and I can even get
the drop-down list to show the list of UserControls. But when I select one
of them, I get a designtime error of "Invalid property value - Object type
cannot be converted to target type." I have tried numerous combinations of
overriding CanConvertFrom/ConvertFrom & CanConvertTo/ConvertTo without
success.

Can someone give me a push in the right direction? Thanks.

Tony
 
G

Guest

Are you overriding the 'GetCreateInstanceSupported', 'CreateInstance', and
'ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo
culture, object value, Type destinationType)' methods it your type converter?

If not, it could be that your type converter is not creating the proper
instance type.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top