Silverlight navigation with prism navigation issue

Topics: Prism v4 - Silverlight 4
Dec 13, 2010 at 3:01 PM

Hi,

I'm using the silverlight navigation framework in conjunction with Prism region navigation. Based on url requested I do a region navigation. I'm using MEF all over. All works fine.

But noticing a strange behavior. When I navigate away from a module (view) in my region it seems to be calling the Loaded event of the view in that region. It doesnt recreate it from just calls the Loaded event before calling the OnNavigated from. I have been trying the debug through the stack trace, but havent been able to figure out why this is happening.

Even more strange is it happens only for the first view loaded into the region for the very first time. Thereafter its fine. That is

  • Load ViewA in Region1
  • ViewA Loaded called followed by OnNavigatedTo
  • Navigating to ViewB
  • ViewA Loaded called again, followed by OnNavigatedFrom - undesired. not sure why Loaded is being called
  • ViewB loaded called followed by OnNavigatedTo
  • Navigating to ViewC
  • ViewB OnNavigatedFrom called
  • ViewC Loaded called followed by OnNavigatedTo
  • Navigating to ViewA
  • ViewC OnNavigatedFrom called
  • ViewA Loaded called followed by OnNavigatedTo
  • Navigating to ViewD
  • ViewA OnNavigatedFrom called - desired behavior

Any idea what could be happening?

 

 

Dec 13, 2010 at 7:56 PM

Hi,

We´ve had no similar issues reported so far. It could be helpful if you could provide us with a repro sample or more information about your scenario, so we can help you solve this issue.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

Dec 15, 2010 at 3:20 PM

Hi Miguel,

Unfortunately I couldnt reproduce this issue in a sample project. But it is happening in my main application. I guess I need to figure this out on my own :(.