Beispiel #1
0
        /// <summary>
        /// Get the values to form the list by calling the <c>IEventBindingService</c> service
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            EventPropertyDescriptor ed = context.PropertyDescriptor as EventPropertyDescriptor;

            if (ed != null)
            {
                ICollection col = ed.Service.GetCompatibleMethods(((EventPropertyDescriptor)context.PropertyDescriptor).Event);
                return(new StandardValuesCollection(col));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public EventDescriptor GetEvent(PropertyDescriptor property)
        {
            EventPropertyDescriptor ep = property as EventPropertyDescriptor;

            if (ep == null)
            {
                return(null);
            }
            else
            {
                ep.ResetValueRequest += new EventHandler(ep_ResetValueRequest);
                ep.SetValueRequest   += new EventHandler(ep_SetValueRequest);
                ep.GetValueRequest   += new EventHandler(ep_GetValueRequest);
            }
            return(ep.Event);
        }
Beispiel #3
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (context != null)
     {
         EventPropertyDescriptor ed = context.PropertyDescriptor as EventPropertyDescriptor;
         if (ed != null)
         {
             ed.SetValue(context.Instance, value);
         }
         return(value);
     }
     else
     {
         return(base.ConvertFrom(context, culture, value));
     }
 }
Beispiel #4
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (value != null)
     {
         if (value.GetType() == typeof(string))
         {
             return(value);
         }
     }
     if (context != null)
     {
         EventPropertyDescriptor ed = context.PropertyDescriptor as EventPropertyDescriptor;
         if (ed != null)
         {
             return(ed.GetValue(context.Instance));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }