Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / October 2007

Tip: Looking for answers? Try searching our database.

Get the ExternaProvider Control Refrence in the UITypeEditor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ahmed Hashish - 27 Sep 2007 13:38 GMT
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;

           }

…….

       }

……

}
Roger Stewart - 27 Sep 2007 14:52 GMT
public override object EditValue(ITypeDescriptorContext
context, IServiceProvider provider, object value)
       {
           if(context == null || context.Instance == null || provider
== null)
               return value;

           ....

           MyControl ctrl = context.Instance as MyControl;
           if(ctrl == null) return null;

           ....
       }
Ahmed Hashish - 30 Sep 2007 12:34 GMT
Thanks for replay
I think you didn't got what I mean, context.Instance returns the reference of the current selected control, I need a reference for MyControl (Extender Provider) the control that provided the property the user currently editing.

best regards,
Ahmed
         public override object EditValue(ITypeDescriptorContext
 context, IServiceProvider provider, object value)
         {
             if(context == null || context.Instance == null || provider
 == null)
                 return value;

             ....

             MyControl ctrl = context.Instance as MyControl;
             if(ctrl == null) return null;

             ....
         }
Ahmed Hashish - 01 Oct 2007 13:12 GMT
I found it,
ExtenderProvidedPropertyAttribute EPPA = context.PropertyDescriptor.Attributes[typeof(ExtenderProvidedPropertyAttribute)] as ExtenderProvidedPropertyAttribute;

MyControl sd = (MyControl)EPPA.Provider;

thanks
Ahmed

 Thanks for replay
 I think you didn't got what I mean, context.Instance returns the reference of the current selected control, I need a reference for MyControl (Extender Provider) the control that provided the property the user currently editing.

 best regards,
 Ahmed
   "Roger Stewart" <rstewart27104@gmail.com> wrote in message news:1190901166.196448.183890@r29g2000hsg.googlegroups.com...
           public override object EditValue(ITypeDescriptorContext
   context, IServiceProvider provider, object value)
           {
               if(context == null || context.Instance == null || provider
   == null)
                   return value;

               ....

               MyControl ctrl = context.Instance as MyControl;
               if(ctrl == null) return null;

               ....
           }
Ahmed Hashish - 30 Sep 2007 13:43 GMT
Thanks for replay
I think you didn't got what I mean, context.Instance returns the reference of the current selected control, I need a reference for MyControl (Extender Provider) the control that provided the property the user currently editing.

best regards,
Ahmed
         public override object EditValue(ITypeDescriptorContext
 context, IServiceProvider provider, object value)
         {
             if(context == null || context.Instance == null || provider
 == null)
                 return value;

             ....

             MyControl ctrl = context.Instance as MyControl;
             if(ctrl == null) return null;

             ....
         }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.