This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have public enum SomeEnum my class has property public SomeEnum Value {......} When I edit that property I would like combo box display not Enum1, Enum2 but different names so i created TypeConverter public class SomeEnumConverter: TypeConverter public override object ConvertTo(......) Applied type converter to my property doesnt work (I am using latest night build) [TypeConverter(typeof(SomeEnumConverter))] |
|
|
This occurs because your custom type converter does not override GetStandardValuesSupported and GetStandardValues. These need to look something like this: public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) Normally you don't need to worry about this because the CLR creates a type converter for the enum type, and that CLR-provided type converter implements these methods for you. However when you apply TypeConverterAttribute you prevent the CLR from providing this default type converter, so you need to implement these methods yourself. By the way, this may just be something you didn't mention, but don't forget to override CanConvertFrom and ConvertFrom as well, otherwise the grid won't be able to translate back from the UI representation to the enum value. |
|