Prism navigation is not working properly with scoped region defined inside a silverlight tab control

Topics: Prism v4 - Silverlight 4
Jul 12, 2013 at 11:40 AM
<telerik:RadTabControl x:Name="QuoteViewTab"
                       prism:RegionManager.RegionName="QuoteTabRegion" 
                       DropDownDisplayMode="Visible" 
                       VerticalAlignment="Stretch" 
                       Style="{StaticResource TabControlStyle}">

</telerik:RadTabControl>
user can load different quotes in different tabs in this tabcontrol. if selected quote already exist in the tabs then that tab will be selected otherwise new tab will be created be region

QuoteView also implements IConfirmNavigationRequest.
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
{
    if (this.Quote.Id == navigationContext.Parameters["id"])
    {
        return true;
    }
    return false;
}
now when i load different views in main region IsNavigationTarget of TabView is called properly along with nevigated from and nevigated to but when i try to load quotes in tab region all three functions are called first time and after that whatever quote is selected it will show already loaded quote.

thats how i load quoteview in QuoteTabRegion
 _container.RegisterType<object, QuoteView>(typeof(QuoteView).FullName);
 _regionManager.Regions["QuoteTabRegion"].RequestNavigate(new Uri(typeof(QuoteView).FullName + parameters.ToString(), UriKind.Relative));
Developer
Jul 12, 2013 at 5:30 PM
Hi,

It would be helpful if you could provide us with more details regarding your implementation, for example:
  • The OnNavigatedTo and OnNavigatedFrom methods of the view / view model.
  • How you are setting the id of each view / view model.
  • The content of the parameters variable used to create the Uri when you invoke the navigation request.
Also, I find the condition of your IsNavigationTarget method strange. When requesting a parameter from the NavigationContext you will receive a string, however you are comparing it using the == operator. Please check if this condition is behaving as you expect.

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini
Jul 12, 2013 at 10:10 PM
Hi DCherubini,
  • The OnNavigatedTo and OnNavigatedFrom methods are empty for now as i want to test prism nevigation first and then write my code inside these functions
  • view and view model doesnot have any id.
  • Quote.Id is also a string field so there is no issue in comparing them
Developer
Jul 15, 2013 at 8:37 PM
Hi,

It would be useful if you could provide us with a repro-sample application portraying this so that we can analyze it and help you find the cause behind this behavior that you are experiencing in your application.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini