Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Extra Viewmodel deactivation using SimpleMDI example.

$
0
0

Hi,

I'm reasonably sure there's simple explanation for this behaviour that's just passed me by.

Using the SimpleMDI as a starting point to create a simple example, I've made the TabViewModel a OneActive screen Conductor (I intend using it to manage multiple screens appearing on a single tab).

In this simple example I've then added a UserControl "TestView" with a corresponding "TestViewModel" that is Activated in the TabViewModel constructor and resides in a ContentControl on the TabView.

I'm writing to the debug window whenever "TestViewModel" has the OnDeactivate method called.

Every time I create a new tab, the "TestViewModel" OnDeactivate method fires, which I'm expecting because the tab it resided is now inactive. The same thing happens when I switch tabs, as each new tab and associated "TestViewModel" becomes active, the previous one is deactivated.

the behaviour I'm having trouble understanding occurs when the application is closed, I see additional OnDeactivate methods fired for each of the tabs I have open, I would expect to see only one, since the others are deactivated when I navigate away from them.

I have some inkling that I'm doing something incorrectly, or that I'm not entirely understanding what I'm doing in this example; I'm potentially misusing the Conductor, or not accounting for a ViewModel somewhere.

I can include my simple example if needed, but I'm sure it's just a daft question. Thanks for any help.

 


Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>