In a property grid, I have implemented for a property both a StringConverter to display a list of values and a UITypeEditor to open a form for editing.
Each work well separately. However, when I put both of them together, StringConverter and the UITypeEditor, I dont see the ellipsis to edit my property. The ellipsis is hidden below the arrow of the dropdown.
Any idea?
Code below -- if that helps
[Editor(typeof(VideoDeviceEditor), typeof(UITypeEditor))]
[TypeConverter(typeof(VideoDevicesList))]
public class VideoDevices
{
}
public class VideoDevicesList : System.ComponentModel.StringConverter
{
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
ChannelPropertyConfiguration inst = (ChannelPropertyConfiguration)context.Instance;
List<string> lgs = new List<string>();
lgs.Add("Microsoft Life Cam");
lgs.Add("Logitech Web Cam");
return new StandardValuesCollection(lgs);
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
}
public class VideoDeviceEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if (svc != null)
{
MessageBox.Show("OK");
}
return value;
}
}