Event using generic EventHandler<> not visible in Designer

前端 未结 1 879
抹茶落季
抹茶落季 2021-01-14 03:09

I\'ve just noticed that if I add an event using a generic eventhandler to my UserControl, the event is not visible in the designer when I add the user control to a form.

相关标签:
1条回答
  • 2021-01-14 03:28

    The Windows Forms designer has limited support for generic types. It will work okay when you avoid the generic type argument for EventHandler<T>:

        public class TEventArgs<T> : EventArgs { }
        public class MyEventArgs : TEventArgs<int> { }
        public event EventHandler<MyEventArgs> EventNowAlsoVisibleInDesigner;
    
    0 讨论(0)
提交回复
热议问题