Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design Time viewing for User Control events

I've create a WinForms control that inherits from System.Windows.Forms.UserControl...I've got some custom events on the control that I would like the consumer of my control to be able to see. I'm unable to actually get my events to show up in the Events tab of the Properties window during design time. This means the only way to assign the events is to programmatically write

myUserControl.MyCustomEvent += new MyUserControl.MyCustomEventHandler(EventHandlerFunction);

this is fine for me I guess but when someone else comes to use my UserControl they are not going to know that these events exist (unless they read the library doco...yeah right). I know the event will show up using Intellisense but it would be great if it could show in the properties window too.

like image 644
Michael Prewecki Avatar asked Sep 27 '08 02:09

Michael Prewecki


1 Answers

Make sure your events are exposed as public. For example...

[Browsable(true)]
public event EventHandler MyCustomEvent;
like image 118
Phil Wright Avatar answered Sep 20 '22 17:09

Phil Wright