samedi 9 mai 2015

Load MenuItems from external DLL and call Command of MenuItem

I am developing an WPF application which should be extendable via plugins. Every plugin is a WPF user control library. When the application is loaded I search for a specific folder and load the assembly via reflection. Every class that implements the specific interfaces which are defined in my main application are loaded and duplicated (because every MenuItem must not have 2 parent elements) and added to my control.

The menu items are loaded and displayed correctly, unfortunately the command (mvvm pattern) is not triggered when the menu item is selected. I do not know how to handle those events or which pattern should be used to link events to dynamically loaded controls during runtime.

Aucun commentaire:

Enregistrer un commentaire