I have created an editor for a property.
I would however like to pass some arguments to the constructor of the editor, but I am unsure as to how to do this.
FOO _foo = new foo();
[Editor(typeof(MyEditor), typeof(UITypeEditor))]
public object foo
{
get { return _foo; }
set {_foo = value;}
}
~
class MyEditor: UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
//some other code
return obj;
}
}
of course you can add another (parametrized) constructor to your myEditor class, something like this:
the problem is that you should also be in control of who calls that constructor because only then you can decide which constructor to use and you can specify/assign a value to the parameters.