This is a migrated thread and some comments may be shown as answers.

RadTabControl Header Binding Issue In MVVM Prsim

1 Answer 75 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Anand
Top achievements
Rank 1
Anand asked on 15 Jul 2014, 06:14 AM
hello All,
I'm new to Silverlight, MVVM, Telerik, Prsim. I'm trying to Create A RadTabControl which will Have 4 Tabs. So I created 1 Module in My Prism project And I have create RadTabControl
AdminTabControl.xaml
<telerik:RadTabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              Grid.Column="1" Grid.Row="1"  x:Name="AdminTabContainer"
                              Prism:RegionManager.RegionName="AdminTabContainerRegion"
                             >
           <telerik:RadTabControl.ItemContainerStyle >
               <Style TargetType="telerik:RadTabItem">
                   <Setter Property="HeaderTemplate">
                       <Setter.Value>
                           <DataTemplate>
                               <TextBlock Text="{Binding ViewTabName}"/>
                           </DataTemplate>
                       </Setter.Value>
                   </Setter>
               </Style>
           </telerik:RadTabControl.ItemContainerStyle>
           <!-- <telerik:RadTabItem x:Name="UserTab" Header="Users">
               <Grid Background="Transparent"/>
           </telerik:RadTabItem>-->
       </telerik:RadTabControl>

And I Created A Another UserTab in View & ViewModel Like this.

   UserTab.xaml
<telerik:RadGridView x:Name="UserTabGridDataView"
          Grid.Column="0"
          Grid.Row="0"
          HorizontalAlignment="Stretch"            
          VerticalAlignment="Top"
          HorizontalContentAlignment="Left"/>

And In my AdminModule.cs


public void Initialize()
       {
           this.RegisterViewsAndServices();
           if (this.regionManager.Regions.ContainsRegionWithName(RegionNames.HPMS_CENTER_REGION))
           {
               var vm = this.container.Resolve<AdminstratorTab>();
               this.regionManager.Regions[RegionNames.HPMS_CENTER_REGION].Add(vm);
 
              var userTab = this.container.Resolve<UsersTabDataGrid>();
              var b = (IUsersTabDataGridViewViewModel)userTab.ViewModel;
               b.ViewTabName = "Users";
                
               userTab.ViewModel = b;
               this.regionManager.Regions[RegionNames.HPMS_ADMINTAB_REGION].Add(userTab);
           }
       }
 
       protected void RegisterViewsAndServices()
       {
           this.container.RegisterType<AdminstratorTab>();
           this.container.RegisterType<IAdminstratorTabViewViewModel, AdminstratorTabViewViewModel>();
           this.container.RegisterType<UsersTabDataGrid>();
           this.container.RegisterType<IUsersTabDataGridViewViewModel, UsersTabDataGridViewViewModel>();
 
       }

My UserViewViewModel  is Like this :
public class UsersTabDataGridViewViewModel : ViewModelBase, IUsersTabDataGridViewViewModel
    {
        public UsersTabDataGridViewViewModel() {
            this.ViewTabName = "Users";
        }
 
        private string _viewTabName;
        public string ViewTabName
        {
            get { return _viewTabName; }
            set {
                _viewTabName = value;
                OnPropertyChanged("ViewTabName");
            }
        }
    }

now with this code I'm able to Load the Application But Tab Doesn't Show Tile As Users. How to Resolve this.

Another Confusion:
1. Without Creating Custom Region Adapter I was able to See My Tab Control & Grid in that 1 tab. I didn't bind my UserDomainService yet. So it is Not Required. As most of the Froum I digged most of the Devleopers have Implemented. So why it is running in my case.
2. Even After custom Implementation Situation is same.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 17 Jul 2014, 04:24 PM
Hello Anand,

Thank you for your question.

I was not able to reproduce your scenario with the provided code. Can you please send me an isolated project that demonstrates your implementation? This will help me in better understanding your scenario and assist you in resolving the reported behavior.

Thank you for any help you can provide.

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
TabControl
Asked by
Anand
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or