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

Access to tab in hierarchy

1 Answer 58 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Hazeest
Top achievements
Rank 1
Hazeest asked on 03 Nov 2009, 03:02 PM
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.

1 Answer, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 06 Nov 2009, 03:09 PM
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.
Tags
TabControl
Asked by
Hazeest
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Share this question
or