views:

51

answers:

3

Hi, I'm writing an application that is supposed to show and hide the content of the main window stack panel based on the user choice. For example, the user clicks on the button that displays the list of the customers, then click on the button that displays the ordering form. The customers content should be hidden and the ordering form should be visible. Moreover, if there are contents with related information (like customers and their data) I want to be able to change the data in one window and it should automatically refresh the data in the other window when the user decides to open it. Is there a good way to do it in MVVM? Thanks for any suggestions.

+2  A: 

Because this question is so generic, the answer must be as well, and the answer is that this is exactly what MVVM is for - modeling data and binding it as needed. In fact, I would argue that a majority of MVVM examples you find online will be some flavor of an answer to your question, most likely using good ol' Northwind.

It sounds like you need to really take a good look at how you want to do your design before you jump in and start coding.

Wonko the Sane
A: 

You might want to check out Prism (or as it is really named Composite Application Guidance). You can build really complex and modular designs with it.

Goblin
A: 

You might be interested in the MVVM sample applications of the WPF Application Framework (WAF).

  1. Writer: Shows how the Views (UserControls) can be switched (Edit mode; Print Preview mode).

  2. BookLibrary: Shows how data modified in one View is automatically updated in other Views.

jbe