Reuse Modules with different Views?

Topics: Prism v2 - WPF 3.5
Aug 19, 2009 at 8:26 AM
We are developing a few products for different customers. All the products have in 90% the same logic but they don't look the same.
Every product have a different "look" depend on the customer requirements.
Is there any way to reuse the modules but have different views?
I thought of using a Data Template to represent the views, but from experience not every view interaction can be done with a Data Template.
I there any clean way to do that?
Aug 19, 2009 at 5:56 PM


Yes, there is a way to do this. If most of the logic in the applications is  similar, and the UI is the main difference, then the situation is pretty similar as developing a WPF and Silverlight app (multitargeted). In this kind of scenario, Prism and the MVVM pattern come in very handy, because you have your logic highly decoupled from your UI. If you put your entire infrastructure (services, models, etc) in place first, you will only have to make the necessary UI changes but maintaining the same functionality.

In my personal opinion, combining WPF styling capabilities, with commands, the MVVM pattern and DI you have to do nothing in particular to reduce the code duplication. All you will have to do is hook up the views to the ViewModels/Presenters and your application will be good to go.

I assume you will also have unit tests (one of the benefits of Composite applications is an increase testability level), so you always have your tests to fall back on.


You might find interesting the articles in the prism Knowledge Base related to MVVM: Model View ViewModel (MVVM)


Please let me know if this helps.

Damian Schenkelman