I did some research on the System.Drawing.Design.UITypeEditor
as I tried to answer this[^] C# forum thread.
My task was it, to pass information (public members) from a derived label control, to a designer DropDownControl.
So I created a class which inherits from UITypeEditor
and overrided the neccesary methods.
public class SelectControlEditor : UITypeEditor
...
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
...
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
...
In the EditValue
method, were the DropDownControl is initialized, I was thinking of getting all my information over the object value
parameter, which would force me changing the type of the concerned property. -> Bad Idea!
But then I looked a little closer at the ITypeDescriptorContext context
parameter. And there I found the Instance[^] property, which holds the reference to the object which invokes the TypeDescriptor.
Casting this to the propper type enabled me to get the member information I needed. :-D
...
Control owner = context.Instance as Control;
...
I hope this Tip is of some value for somebody.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.