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:
- Start the app. See the shared view.
- Switch to second tab. See the shared view.
- Switch back to first tab. Shared view is gone.
- Switch to second tab again. The shared view is there.
- Proceed to pull hair out.
You can see the example application on my github.