D
D
DarkByte20152016-05-16 10:55:42
WPF
DarkByte2015, 2016-05-16 10:55:42

How to organize page switching?

I am reading this article. And I just can not understand how the page switching is organized there? I see the ViewModel bind, but how exactly is the View changed? And I'm also going to do something similar, only I won't have page switching buttons in MainWindow (they don't fit into the interface). And I will bind directly to the content of the window. So the question is how to switch this content from nested pages? For example, somewhere in the nested (binned) page, a button was pressed and the window content needs to be switched. The only thing that comes to mind is to use the messenger pattern, for example, there is an excellent one in mvvm light. But maybe there is another solution?
There is a line like this: Content="{Binding CurrentPage}", but the only CurrentPage I found in the project is WizardBaseViewModel's CurrentPage in MainViewModel. Can't the content be bound to the ViewModel? The content should be bound to some other DataTemplate, as I understand it...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Silin, 2016-05-16
@byme

Hello again)
Via DataTemplate.
Depending on what will be in the data context, different controls will be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question