I’m developing an application that both run as a standalone application and a plugin. We’re using dependency injection to inject different implementations of the application logic.
The GUI in the standalone application and the plug-in is identical today, but we’re seeing a need to do minor customizations to the GUI depending on the context. This is typically small changes, like providing different input mechanisms (e.g. a drop down list in the standalone version and a hierarchical selection control in the plug-in version). Typically the controls used in the plug-in version will be controls provided by the plug-in API.
Since there typically will be many small differences between the standalone GUI and plugin GUI rather than big components (e.g. buttons rather than pages in a tab panel) we do not wish to create one XAML for the plugin and one for the standalone sharing a common view-model.
Are there any patterns for injecting user controls in WPF?
Prism! 😀 it is a framework for MVVM/ dependency injection and WPF/Silverlight
See http://compositewpf.codeplex.com/ and Composing the User Interface