Jerry Jerry - 1 year ago 92
C# Question

How do I remove the elipsis for a custom UITypeEditor that is read-only?

I have two fields that are of the same type in my property-grid. However, one is read-only, the other is editable.

Both of these fields are of a custom type, and thus have a custom UITypeEditor, which puts the elipsis ([...]) button on the field.

CategoryAttribute("5 - Wind"),
DisplayName("Factored Area"),
Description("The factored area for the segment."),
EditorAttribute(typeof(umConversionTypeEditor), typeof(UITypeEditor)),
public FactoredAreaClass FactoredArea { ... }

CategoryAttribute("5 - Wind"),
DisplayName("Factored Area Modifier"),
Description("The factored area modifier."),
EditorAttribute(typeof(umConversionTypeEditor), typeof(UITypeEditor)),
public FactoredAreaClass FactoredAreaMod { ... }

In this example, FactoredAreaMod is available to be edited, but BOTH have the elipsis, which will cause great confusion with the users. Any way to turn that off??

Answer Source

Use the ReadOnly attribute. This marks it as design-time read-only while keeping it read/write for runtime use.

Also, you should either apply the Editor attribute to the type rather than the properties. There's no gain in applying it to a property if you don't want that property to be editable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download