Get the ExternaProvider Control Refrence in the UITypeEditor -
09-27-2007
, 08:38 AM
Dear Sir
I created a control "MyControl" that implements the IExternalProvider Class, "MyControl" should provide the property MyProperty for all other controls.
I created also an UITypeEditor class that help the user to select "MyProperty1" form a DropDownList
My Problem is I need to get a reference for MyControl in the EditValue method of the UITypeEditor because the DropDownList changes according to other property "MyProperty2" of "MyControl".
My class code like this:
public class MyControl : UserControl, System.ComponentModel.IExtenderProvider
{
……
public string MyProperty2
{
….
}
[Editor(typeof(SaudisoftMyProperty1Editor), typeof(UITypeEditor)), DefaultValue("")]
public string GetMyProperty1(Control control)
{
……
}
……
public class MyProperty1Editor : UITypeEditor
{
….
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
……
MyControl sd =? //here I want to get MyControl
String M=sd.MyPropery2
……
return value;
}
…….
}
……
} |