I need to use a DesktopPopupMenu with the same data in it on several windows in my app. I thought it would be more efficient to subclass PopupMenu with a method to populate it. I am running into issues with the SelectionChanged event.
The first error I got said the event was already implemented in the super class. I looked up overriding and found something that seemed to say I should add an Event Definition named SelectionChanged
and a method with the same name with code that says RaiseEvent SelectionChanged
. I added an instance of the subclass to a window and added code to its SelectionChanged event.
When I tried to run the app, I got an error for the event definition saying This property has the same name as an event. You must resolve this conflict.
Adding a SelectionChanged Event Handler to my sub-class allows the app to compile, but nothing is passed to the instance on the window
I think I need to be adding some code to the the event definition or the event itself, but have not been able to figure out what it should be. I remember doing something like this several years ago, but don’t remember having this much trouble. An example that shows how to do this would be wonderful.