See Also: IEventBindingService Members
The event binding service provides a way to link an event handler with a component event from designer code.
To link an event handler with a component event using the System.ComponentModel.Design.IEventBindingService, you must first obtain an System.ComponentModel.EventDescriptor for the event of the component you intend to link. The System.ComponentModel.Design.IEventBindingService provides methods that can convert an System.ComponentModel.EventDescriptor to a System.ComponentModel.PropertyDescriptor which you can use to configure the event with an event handler method name.
The System.ComponentModel.TypeDescriptor object provides a System.ComponentModel.TypeDescriptor.GetEvents(Type) method that you can use to obtain an System.ComponentModel.EventDescriptorCollection containing System.ComponentModel.EventDescriptor objects for each event of a component. The IEventBindingService.GetEventProperty(System.ComponentModel.EventDescriptor) and IEventBindingService.GetEventProperties(System.ComponentModel.EventDescriptorCollection) methods of the System.ComponentModel.Design.IEventBindingService return a System.ComponentModel.PropertyDescriptor for each System.ComponentModel.EventDescriptor passed to either method. Each System.ComponentModel.PropertyDescriptor returned from IEventBindingService.GetEventProperty(System.ComponentModel.EventDescriptor) or IEventBindingService.GetEventProperties(System.ComponentModel.EventDescriptorCollection) has a property type of string. You can set this string to a value that indicates the name of the event-handler method to link the event with using the System.ComponentModel.PropertyDescriptor.SetValue(object, object) method of the System.ComponentModel.PropertyDescriptor.