2using System.ComponentModel;
3using System.Drawing.Design;
4using System.Windows.Forms;
5using System.Windows.Forms.Design;
16 #region Overrides of UITypeEditor
23 public override UITypeEditorEditStyle
GetEditStyle(ITypeDescriptorContext context)
25 return UITypeEditorEditStyle.Modal;
38 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider,
object value)
40 var editService = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
42 myEditor.Text = $
"{myEditor.Text} for {context?.Instance?.GetType().Name}";
43 myEditor.EditLabel.Text = $
"Editor for {context?.PropertyDescriptor?.Name}";
44 var res = editService?.ShowDialog(myEditor) ?? DialogResult.Cancel;
45 return res == DialogResult.OK ? myEditor.TheConnectionEdit.Text : value;
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
Just a primitive UI Type Editor to demonstrate how you can add an editor of your own for connection s...
override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
Create your editor form, initialize it from the given value, return if the user accepted the new valu...
override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
We want to show a modal dialog box.
Just a form with a TextBox. Nothing to see here.