Search code examples
caliburn

Move views from one region to another in caliburn


I need to move views from one content control to another, I have no problems with shutdown the views in one control take the view models to the other presentermanager but how can I set the view to be there also? I don't want the views to be created again.


Solution

  • Since the view instance is cached inside the VM, you should automatically get the previous instance hooked when you open the VM in a different PresenterManager. You also have to bind each of the two ContentControl to different PresenterManager.CurrentPresenter:

    <ContentControl cal:View.Model="{Binding PresenterManager1.CurrentPresenter}" />
    <ContentControl cal:View.Model="{Binding PresenterManager2.CurrentPresenter}" />
    

    (sorry for possible errors in property naming, you are probably using old 1.1 version)