I have default properties window looks like next:
Is it possible to change somehow this view?
For example I want to show my Template.Name property value and Template.Description instead [array index] and namespase.
Any possibilities to do that?
I have default properties window looks like next:
Is it possible to change somehow this view?
For example I want to show my Template.Name property value and Template.Description instead [array index] and namespase.
Any possibilities to do that?
I think, try by inherit class CollectionConverter
and override method ConvertTo
. And then assign the new custom converter class as a attribute: TypeConverter
to the property.
internal class TemplateArrayConverter : CollectionConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
{
if (destType == typeof(String) && value is OutlookAddIn_MailHelper.Template[])
{
OutlookAddIn_MailHelper.Template[] templates = (OutlookAddIn_MailHelper.Template[])value;
if (templates.Length > 0)
{
return String.Format("Total Template: {0}", templates.Length);
}
}
return "None";
}
}
On the property:
[TypeConverter(typeof(TemplateArrayConverter))]
public OutlookAddIn_MailHelper.Template[] Templates { get; set;}