Access to tab in hierarchy

2 posts, 0 answers
  1. Hazeest
    Hazeest avatar
    12 posts
    Member since:
    Oct 2009

    Posted 03 Nov 2009 Link to this post

    I have a tab control in hierarchy
    xaml:
    <telerikNavigation:RadTabItem IsEnabled="{Binding Loaded}" Loaded="RadTabItem_Loaded" Margin="10,0,0,0" Height="24" FontWeight="Bold" FontSize="11" Foreground="Black"  Background="Gray"
                            <telerikNavigation:RadTabItem.Header> 
                                    <TextBlock Text="Linked titles" /> 
                            </telerikNavigation:RadTabItem.Header> 

    c#:
            private void RadTabItem_Loaded(object sender, RoutedEventArgs e) 
            { 
                RadTabItem tab = (RadTabItem)sender; 
                if (!itemSpecs.ContainsKey(hier_selectedId.ToString())) 
                { 
                    itemSpecs[hier_selectedId.ToString()] = new linnworks.cloud.dataModel.Inventory.StockItemClass(); 
                } 
                tab.DataContext = itemSpecs[hier_selectedId.ToString()]; 
     
            } 
     

    itemSpecs[id].Loaded = false;

    Then later in code I'm changing this to itemSpecs[id].Loaded=true (it binding with isEnabled)
    itemSpecs is ObservableDictionary and it implements INotifyCollectionChanged, INotifyPropertyChanged
    But I stil need to close and then again expand grid to enable this tab. 
    Is there any way to get the tabItem by name in hierarchy so I could change isEnabled property in code.
    Thanks.
  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 06 Nov 2009 Link to this post

    Hello Hazeest,

    The binding will be updated accordingly if the business object that is used as a DataContext for the TabItems is implementing the INotifyPropertyChanged interface. You mention that the collection you give as ItemsSource is observable, but that will help only if you add/remove entire items from it. So, if you make the items in that collection observable as well, you will be able to solve the problem.

    All the best,
    Tihomir Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top