Question

I am working on a personal project. I started with a previous post (Point of Sale Application Architecture).

Trying to Use- repository - service and View Modal - View approach

Please see the attached image file. Most of my windows will have multiple views.

My Questions are:

  1. Looking at the windows do you think my project is a good candidate for CAG (Prism) or is it an overkill
  2. Will I be able to get POPUp modal windows and communicate to them from its parent view- region-module.
  3. Multiple Windows in Prism ( assuming that I can create multiple shell) , Is communication between them complex
  4. read on SO about creating complex views with sub views as properties. Is this a good approach or will too much code

The more I look into applying some pattern more I am getting confused

I am sure there are some of you had similar issues and may be your approach might solve things for me.

Thank you Mar

http://www.flickr.com/photos/themarworld/3820178039/ http://www.flickr.com/photos/themarworld/3820178039/

Was it helpful?

Solution

I can't see your screenshot but I can give you a little direction here. I've been setting up the shell of a multi-targetted (WPF/Silverlight) composite app recently, learning the libraries as I go.

  1. "Most of my windows will have multiple views." -- this by itself probably means you'll like what you find in the Composite Application Library. And MVVM is a perfect pattern for the CAL. In the StockTrader reference application they use the term PresentationModel, but this is essentially the same thing as MVVM.

  2. Popup modals work great in both WPF and SL (via the Toolkit extension ChildWindow control). You'd communicate with them in same way you would a regular region - by injecting views and services. What I found particularly neat about this is that you can define a region in a popup, register views with it when the app (module) is loaded (even though the region itself is not yet loaded), and then when the region pops up the correct views are injected at that point. In other words you don't have to get involved in deferring the injection of the view until the region is displayed, which I was expecting to have to do.

  3. Haven't tried this -- can't comment.

  4. Not sure about "sub-views", but regions within regions is certainly possible.

OTHER TIPS

Wayne has good answers for #1 and #2... I'll get #3 and #4.

3) Communication between views that don't share the same view model is done through the EventAggregator in Prism. It's a very easy to use Publisher Subscriber model for messages. You'll have no trouble understanding this.

4) I don't like the idea of having a view as a property of a view model. It's a problem of separation of concerns. You're shooting for your ViewModels to be interface agnostic and this would imply too much interface leaking into your viewmodels. 2 acceptable alternatives would be

  • Sub ViewModels as properties of your ViewModel. You could use DataTemplates to provide the look to them without specifying the UI in the ViewModel.
  • Sub Regions. This is a perfectly acceptable. Sometimes it can get tricky depending on your UI because you'll end up trying to keep track of your RegionManager scopes, but it's doable.

HTH, Anderson

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top