You need to create UITypeEditor. The following is a template for the combox editor: -
public class MyCustomEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider)
{
var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
var list = new ListBox();
EventHandler onclick = (sender, e) => {
editiorService.CloseDropDown();
};
list.Click += onclick;
myEditorService.DropDownControl(list);
list.Click -= onclick;
return (list.SelectedItem != null) ? list.SelectedItem : Guid.Empty;
}
}
According to your property in the activity: -
[Editor(typeof(MyCustomEditor), typeof(UITypeEditor)]
public Guid MyGuidValue
{
get { return (Guid)GetValue(MyGuidValueProperty); }
set { SetValue(MyGuidValueProperty, value); }
}
- The attribute
Editortells PropertyGrid that you created your own editor for this property. GetEditStyle .EditValue.DropDownControl, , .DropDownControl , CloseDropDown.