Live Chat Icon For mobile
Live Chat Icon

In my UITypeEditor for a collection, how do I change the ‘(collection)’ string to a string of my own

Platform: WinForms| Category: Type Editors

The string ‘(Collection)’ is coming from the TypeConverter on that property, which is CollectionConverter. To modify this value, do the following…

public class MyCollection : SomeBaseCollectoin
    // ...

internal class MyCollectoinConverter : System.ComponentModel.CollectionConverter 
      public override object ConvertTo(ITypeDescriptorContext context,
CultureInfo culture, object value, Type destinationType) 
            if (destinationType == typeof(string)) 
                if (value is ICollection) 
                    return 'You can return what ever string value you want
            return base.ConvertTo(context, culture, value, destinationType);

(from on microsoft.public.dotnet.framework.windowsforms)

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.