tags:

views:

37

answers:

2

I know it might be silly, I have just started with WPF.

I want to switch to a different view when a user clicks on a control, for example showing a detail page after a click on a list. This view would replace the original.

In a web application this would be navigating to a different page. What is the local idiom for that?

+1  A: 

I believe that you want to open a different dialog box.

I organize my WPF controls like so, in a form of the MVC pattern:

views <==> controller <==> data

So, when you click on a view, the controller handles the logic of the click, kind of like how a web server handles the logic of user input. The controller then determines whether to open another view or not. If the user input requires some storage or handling of state, then the controller passes that off to the 'data' section. That data class will then put things to disk, if necessary. The controller could also pass off to a 'processing' class, that will process the input and give it back to the controller, which then determines whether to display the results to the user, put them in a file, both, or neither.

tl;dr- put your control logic in a backend class rather than the window itself. That backend will then open another window.

mmr
A: 

To date I have structured my app such that all the views in the path (think of a wizard or similar multi-stage input) are in a TabControl.

I can easily hide tabs (visibility=collapsed) and pring a given tab to front.

I am going to handle navigation in code behind, handling Click and MouseDown events.

Business logic will be handled by commands attached to UI elements. Commands are executed right after code behind, it seems. This allows for unit testing of business logic without tampering with the user interface.

This way I should have all the benefits of MVVM with minimum hassle. Of course a better architecture is very welcome. The library of choice is, for the time being MVVM foundation.

mico