Skip to content

kmcginnes/PoC.CaliburnSharedViews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PoC.CaliburnSharedViews

I've run across an issue using Caliburn.Micro when sharing a Screen between multiple parent Screens. In this example I have 2 tabs inside a shell. Each tab shares a single instance of SharedViewModel (essentially a singleton).

var shared = new SharedViewModel();

Items.AddRange(new []
{
    new TabViewModel { Shared = shared },
    new TabViewModel { Shared = shared },
});

And each tab's view has a ContentControl bound to the Shared property which is SharedViewModel:

<ContentControl cal:View.Model="{Binding Shared}"/>

Here's the order of events:

  1. Start the app. See the shared view.
  2. Switch to second tab. See the shared view.
  3. Switch back to first tab. Shared view is gone.
  4. Switch to second tab again. The shared view is there.
  5. Proceed to pull hair out.

About

Demonstrates issue sharing views between multiple Caliburn screens

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages