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

Commented Unassigned: Caliburn.Micro subscribes multiple times to PropertyChanged [326]

$
0
0
I have the problem that CM seems to subscribe twice to PropertyChanged. Or, depending on the POV / expected behavior: It doesn't *unsubscribe* when the item is deactivated.

The scenario is the following:

I have a view model (`OuterViewModel` in the sample) that has a property (`CurrentInnerViewModel`) of another view model (`InnerViewModel`).

Outer has a button. A click on the button cycles through all inner view models it knows, one at a time. When there are no more, it activates the next screen (`NextViewModel`) (see `OuterViewModel.ShowNext`).

Next has a button that simply activates the previous screen.

Now, clicking in fast succession on the "Show next" and "Show previous" buttons with an attached debugger shows that multiple views get created for a single raised PropertyChanged event (see Output pane).



Comments: Changing `UITranslator` method to the following removes the issue: ``` C# private static void OnTranslateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { GC.Collect(); return; } ``` So this is not Caliburn.Micro related.

Viewing all articles
Browse latest Browse all 1760

Trending Articles



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