3

I have implemented ISupportsActivation and added calls to this.WhenActivated for both the view model and the view. It seems to me that the delegate gets called twice. Both for activation and deactivation. Is this by design or am I doing something wrong? If this is by design, is there any way to know if the call is for activation or deactivation?

The view model is data bound to a ViewModelHost if that matters in any way.

Magnus Lindhe
  • 7,157
  • 5
  • 48
  • 60

1 Answers1

3

I know one case this happens, that is if you use RoutedViewHost or ViewModelViewHost. As reported here and there, when switching the view content, the old/previous view model gets deactivated-reactivated-(animated)-deactivated.

And you get called on WhenActivated at that time.

That is clearly a bug and it's caused by the implementation of TransitioningContentControl.

Community
  • 1
  • 1
Gluck
  • 2,933
  • 16
  • 28