I wrote a custom UITypeEditor for my type Smiley per MSDN's walkthrough http://msdn.microsoft.com/en-us/library/ms171840.aspx
When the user clicks the ellipsis, my UITypeEditor will launch a modal dialog box.
public class SmileyEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
After MUCH PAIN I found it works if my type is a Class, but not if it's an enum. What's going on?
[Editor(typeof(SmileyEditor), typeof(System.Drawing.Design.UITypeEditor))]
public Smiley face { get; set; }
If the type Smiley is an enum, then the property grid doesn't show the ellipsis button, just a drop down. Why?
Apparently when a system type editor exists, PropertyGrid prefers it over one's custom editor. A workaround is to annotate your type with a TypeConvertorAttribute, referencing a TypeConvertor that overrides the method GetStandardValuesSupported
. See https://stackoverflow.com/a/4067173/284795