Bharat Leel

Bharat Leel

  • NA
  • 104
  • 6.5k

Create Custom Event in Custom UITypeEditor which can be used

Dec 13 2016 8:22 AM
I have one specific requirement.
Using workflow 3.5 I have created and used Custom UITypeEditor.
  1. public static DependencyProperty CustomOwnerProperty= DependencyProperty.Register("CustomOwner"typeof(string), typeof(CustomClass));  
  2. [Editor(typeof(CustomOwnerUIEditor), typeof(System.Drawing.Design.UITypeEditor)), TypeConverter(typeof(Utility.Utility.TypeConverterToRestrict))]  
  3. [CategoryAttribute("Property")]  
  4. public string CustomOwner  
  5. {  
  6.           get  
  7.           {  
  8.                return Convert.ToString(this.GetValue(CustomOwnerProperty));  
  9.           }  
  10.           set  
  11.           {  
  12.                 base.SetValue(CustomClass.CustomOwnerProperty, value);  
  13.           }  
  14. }  
This is custom class which have CustomOwner property which is using CustomOwnerUIEditor class as per below
  1. public class CustomOwnerUIEditor: System.Drawing.Design.UITypeEditor  
  2.     {  
  3.   
  4.         // Here I want to define custom event "CustomOwner" which I can use publicly   
  5.   
  6.         public override object EditValue(  
  7.         System.ComponentModel.ITypeDescriptorContext context,  
  8.         System.IServiceProvider provider, object value)  
  9.         {  
  10.              // This is place where I want to raise custom event "CustomOwner" created for this editor.  
  11.         }  
  12.     }  
This all custom classes/code is created in CustomWorkflow project with framework 3.5, I have added this CustomWorkflow project as reference in RootProject which is in framework 4.5
 
Now at the time of initialization of Workflow Designer I want to access this CustomOwnerUIEditor and register it's Custom Event "CustomOwner" and when use clicks on edit button at that time CustomOwnerUIEditor's EditValue() method called and it should raise custom event so I can handle this event in RootProject which is parent project to CustomWorkflow which is used as reference.
 
How can I achieve this? or is this possible or not?