1
Vote

INaviagtionAware issue when DataContext of View is itself

description

If View is implementing INavigationAware and the dataContext for the view is itself, OnNavigatedTo is getting called twice. I am using RequestNavition api to navigate to the view.
 
Following threads can be referenced where this question is also inquired:
http://compositewpf.codeplex.com/discussions/393632
http://compositewpf.codeplex.com/discussions/280670
http://compositewpf.codeplex.com/discussions/347486
 
Thanks,
Imad.

file attachments

comments

aadami wrote Aug 31, 2012 at 5:59 PM

Hi,

As mentioned in this thread (http://compositewpf.codeplex.com/discussions/393632), I believe a possible work around for this behavior could be replacing the default RegionNavigationService with a custom implementation that avoids the second call when the DataContext of the View is set to itself.

As an example you can find the MefCustomRegionNavigationService class I implemented, attached to this work item.

I hope you find this useful,

Agustin Adami
http://blogs.southworks.net/aadami