IsNavigationTarget never gets called for TabControl region.

Topics: Prism v4 - Silverlight 4
Oct 30, 2010 at 7:41 AM
Edited Oct 30, 2010 at 7:41 AM

When a TabControl region is the target for navigation, I expected all of the existing tab item views/view-models to be queried if they implemented INavigationAware. This does not seem to be the case.

I am using Prism v4 Drop 10 and MEF in my navigation scenario. My TestTabView, a UserControl, has attributes:




I navigate to it like this:




This works, except every time I call RequestNavigate, a new TestTabView is created and the existing one is never queried via INavigationAware.IsNavigationTarget. The TestTabViewModel also implements INavigationAware and it is not queried either. I also tried changing to CreationPolicy.Shared, but all that does is keep re-using the same view instance and the INavigationAware.IsNavigationTarget is still not queried on the view or view-model.

Any suggestions? The quickstart only shows a ContentControl navigation example.

Oct 30, 2010 at 7:43 AM

The overall scenario that I'm trying to implement is documented in another thread -

Oct 31, 2010 at 8:51 AM

Figured out the problem. [Export("TestTab")] had to be changed to [Export("TestTabView")] so that the name of the contract matched the name of the class type.

More details in a comment on this related issue -

Nov 2, 2010 at 7:12 PM

Hi Wayne,

I am glad that you figured out the problem in your scenario. Based on this information, I assume that the work-item 7468 can be closed.

Please let me know if you have any other question.

Fernando Antivero

Nov 2, 2010 at 9:51 PM

Well, no I don't think it should be closed because there is still a bug.

According to the documentation, the navigation string does not have to be the same as the type name. However in that issue I have shown that it DOES have to be the type name in order for the INavigationAware.IsNavigationTarget method to get called at all.