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

Tab not updating properly?

1 Answer 78 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Todd Davis
Top achievements
Rank 1
Todd Davis asked on 10 May 2010, 03:53 PM
This has been boggling me for days - it may well be a Binding mistake on my part, but I'm not sure what I'm doing wrong if that's the case. Here is the situation. I have a RadTabControl with several tabs (this is all inside of RadWindow). The data object that servers as the DataContext of the RadWindow has a few ObservableCollection<T>'s, one if which is a list of Attachments.

The tab that shows the attachments has a GridView in it. I want to display the number of attachments in the Tab, as well as in the GridView. (see http://screencast.com/t/NDg3OTYx to make this more clear - note this screenshot is showing the wrong # of attachments)

Here is partial listing of the Tab, and the GridView within it. Note that both are pulling their data from the exact same source...

            <telerik:RadTabItem x:Name="ManageTab"
                <telerik:RadTabItem.Header> 
                    <TextBlock Text="{Binding FileAttachments, Converter={StaticResource FileCount}}" Margin="5" VerticalAlignment="Center" /> 
                </telerik:RadTabItem.Header> 
 
                <grid:RadGridView x:Name="AttachmentsGrid" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Multiple" CanUserSelect="False"  
                                  RowIndicatorVisibility="Collapsed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding FileAttachments, Mode=OneWay}"
                    <grid:RadGridView.Columns> 
 

The problem is, when I update the DataContext of the RadWindow, the GridView does update, and shows the new attachments, however the TabItem does not update, (the converter is not even called at all), and just shows whatever it did when I first created the Window.

What is going on here? How do I get the TabItem to update?

1 Answer, 1 is accepted

Sort by
0
Todd Davis
Top achievements
Rank 1
answered on 10 May 2010, 11:18 PM
Never mind. It seems that GridView was subscribing to the CollectionChanged  event, but the TabItem was not. We changed the source object so that when CollectionChanged fires, it also throws a PropertyChanged notification.
Tags
TabControl
Asked by
Todd Davis
Top achievements
Rank 1
Answers by
Todd Davis
Top achievements
Rank 1
Share this question
or