Unable to Load Tab in a Tab

Topics: Prism v4 - Silverlight 4
Oct 16, 2014 at 4:37 PM
I've a TabContainer which have 5 tabs. In this 1 tab have another tabContainer with 4 Tabs. My First TabContainer is Loading alright but the tab where I ve created Another TabContainer Region It is not loading anything and Showing Empty Screen for this tab.

My First Tab I created in this way.
 <UserControl.Resources>
        <telerik:ContainerBindingCollection x:Key="TabContainerBindings">
            <telerik:ContainerBinding Binding="{Binding IsSelected}" PropertyName="IsSelected" />
        </telerik:ContainerBindingCollection>
        <DataTemplate x:Key="HeaderTemplate" telerik:ContainerBinding.ContainerBindings="{StaticResource TabContainerBindings}">
            <TextBlock Margin="5,0,0,0" 
                       FontSize="11"
                       FontWeight="Bold"
                       Padding="3"
                       Text="{Binding Title}" />
        </DataTemplate>

        <DataTemplate x:Key="ContentTemplate">
            <ContentPresenter Content="{Binding View, Mode=OneWay}" />
        </DataTemplate>

        <DataTemplate x:Key="SelectorDataTemplate">
            <prism:DataTemplateSelector Content="{Binding}" 
                                        HorizontalContentAlignment="Stretch"
                                        IsTabStop="False">
                <prism:DataTemplateSelector.Resources>
                    <DataTemplate x:Key="UsersTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>
                    <DataTemplate x:Key="DomainTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>
                    <DataTemplate x:Key="GroupsTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>
                    <DataTemplate x:Key="ItemsTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>              
                    <DataTemplate x:Key="RoutesTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>
                    <DataTemplate x:Key="SystemSettingsTabViewModel">
                        <ContentPresenter Content="{Binding View, Mode=TwoWay}" />
                    </DataTemplate>                    
                </prism:DataTemplateSelector.Resources>
            </prism:DataTemplateSelector>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadTabControl HorizontalAlignment="Stretch" 
                               Margin="0,0,0,0" VerticalAlignment="Stretch" 
                               ContentTemplate="{StaticResource SelectorDataTemplate}"
                               ItemTemplate="{StaticResource HeaderTemplate}"
                               prism:RegionManager.RegionName="AdminTabContainerRegion">
        </telerik:RadTabControl>
    </Grid>
IN IModule Class Initialize function :
 this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(IUsersTabViewModel));
                this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(IDomainTabViewModel));
                this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(IGroupsTabViewModel));
                this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(IItemsTabViewModel));
this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(IRoutesTabViewModel));
                this.regionManager.RegisterViewWithRegion(RegionNames.HPMS_ADMINTAB_REGION, typeof(ISystemSettingsTabViewModel));
My ViewModel For TabContainer XAML is INavigationAware and it have a Property of
AdminTabContentSelector TabContentSelector { set; get; }
this class have the following Code :
public class AdminTabContentSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
             base.SelectTemplate(item, container);
             switch ((item as RadItemList).XamlPath)
            {
                case "Users": return this.UsersDataTemplate;
                case "Groups": return this.GroupsDataTemplate;
                case "Domains": return this.DomainsDataTemplate;
                case "Items": return this.ItemsDataTemplate;
                case "Routes_Settings": return this.RouteSettingsDataTemplate;
                case "System": return this.SystemDataTemplate;
                default:
                    return null;
            }
        }

        public DataTemplate UsersDataTemplate { get; set; }
        public DataTemplate GroupsDataTemplate { get; set; }
        public DataTemplate DomainsDataTemplate { get; set; }
        public DataTemplate ItemsDataTemplate { get; set; }
        public DataTemplate SystemDataTemplate { get; set; }
        public DataTemplate RouteSettingsDataTemplate { get; set; }
        
    }
So In RouteSetting Tab I created A region : (xaml)
 <ContentControl 
            Prism:RegionManager.RegionName="RoutesSettingsTabContainerHolderRegion" 
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch"
                        VerticalContentAlignment="Stretch"/>
Now in its ViewModel at constuctor I called a Method for adding view in available Regions with following code :
 private IRegionManager regionManager;
        IUnityContainer container;
        public RoutesTabViewModel(IRoutesTabView view, IUnityContainer container, IRegionManager regionManager)
            : base(view)
        {
            this.Header = "Routes";
            this.Title = "Routes";
            this.container = container;
            this.regionManager = regionManager;
            BuildTabContainer();
        }


        public void BuildTabContainer()
        {
            if (this.regionManager.Regions.ContainsRegionWithName(RegionNames.HPMS_ROUTE_SETTING_TABCONTINERHOLDER_REGION))
            {
                var RoutesTabContainer = this.container.Resolve<RoutesSettingsTabContainer>();
                this.regionManager.Regions[RegionNames.HPMS_ROUTE_SETTING_TABCONTINERHOLDER_REGION].Add(RoutesTabContainer);
            }
        }
but it is not Loading My tab Container in this region. I tryed putting in IModule implantation.
too. This Firs tab Comes on Click at 1 button defined on top Navigation.

I'm confused when User Click on top Button (Administrator ) My First Tab get loading but when I click on Route Tab Region Created in this Tab doesn't Load the View for RouteTabContainer. So how to Proceed & Where I'm going wrong? how to resolve it.

I was able to achive my 1st functionality through forums & dicussions. I'm fairly new to Prism. Please help.