stuartmclark
stuartmclark

Reputation: 1243

Caliburn Micro, Multiple views from a single view model

I have an application that I am currently working on and there is a requirement to change the view based on an event occurring. This event means that the same ViewModel must be used but using a different View. I do not currently know if this is possible to do with Caliburn but I imagine it should be. the main problem I am having is the convention over configuration element of Caliburn. Example:

I have a ViewModel "MainViewModel" and it is bound to "MainView" through convention. When the event occurs I want the application to be displaying "MainView2" instead of "MainView". I can imagine there is a programmatic way of setting this but my inexperience with Caliburn is a problem.

Upvotes: 3

Views: 8082

Answers (1)

gius
gius

Reputation: 9437

You can control which View is used for your ViewModel by setting cal:View.Context property on ContentControl that shows the view.

Have a look here.

Upvotes: 6

Related Questions