Tab not updating properly?

2 posts, 0 answers
  1. Todd Davis
    Todd Davis avatar
    36 posts
    Member since:
    Aug 2009

    Posted 10 May 2010 Link to this post

    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?
  2. Todd Davis
    Todd Davis avatar
    36 posts
    Member since:
    Aug 2009

    Posted 10 May 2010 Link to this post

    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.
  3. DevCraft banner
Back to Top