How do you customize the descriptions in the Collection Editor of the PropertyGrid object?
See the question and my original answer on StackOverflowYou could override ToString(), like this
public class MinorFrameFormatDefinition
{
[Description("Word Number")]
public int WordNumber { get; set; }
[Description("Number of Bits")]
public int NumberOfBits { get; set; }
public override string ToString()
{
return "hello world";
}
}
Or if you don't want to change the class, you can also define a TypeConverter on it:
[TypeConverter(typeof(MyTypeConverter))]
public class MinorFrameFormatDefinition
{
[Description("Word Number")]
public int WordNumber { get; set; }
[Description("Number of Bits")]
public int NumberOfBits { get; set; }
}
public class MyTypeConverter : TypeConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
return "hello world";
return base.ConvertTo(context, culture, value, destinationType);
}
}