RadGridView GroupHeaderTemplate will not disappear when group is empty

5 posts, 0 answers
  1. Dave Aronow
    Dave Aronow avatar
    7 posts
    Member since:
    Sep 2011

    Posted 20 Mar 2012 Link to this post

    I am using the GroupHeaderTemplate to display information about each row
    in my 
    radgridview (which is bound to an ObservableCollection<> of my data
    class).  I am grouping 
    by a unique field on each row so each item in my
    grid will get it's own header.   


    My sample code is below.  When I click the "DeleteButton" in the code
    below the item is being 
    removed from my collection correctly and the
    grid row disappears, but the GroupHeaderTemplate instance 
    for the row 
    remains visible even after the item is removed (and all items are
    removed).  However the 
    binding to the item disappears since the item
    itself is gone (meaning the Description disappears).  


    Any idea why this could be?  
    Thanks.
    Dave

    <telerik:RadGridView.GroupHeaderTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20"></ColumnDefinition>
                    <ColumnDefinition Width="250"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <telerik:RadButton Grid.Column="0" x:Name="DeleteButton"
    Style="{StaticResource ImageButtonStyle}"
    Content="Img/delete.png" Command="telerik:RadGridViewCommands.Delete"
    CommandParameter="{Binding Group.Items[0]}">
                </telerik:RadButton>
                <TextBlock Grid.Column="1"
    Text="{Binding Group.Items[0].Description}" />
            </Grid>
        </DataTemplate>
    </telerik:RadGridView.GroupHeaderTemplate>
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Mar 2012 Link to this post

    Hi David,

    I have tested the case, but I was not able to reproduce the issue you reported. Could you take a look at the sample attached and let me know whether you can reproduce the same behavior on it ?  

    Greetings,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Dave Aronow
    Dave Aronow avatar
    7 posts
    Member since:
    Sep 2011

    Posted 21 Mar 2012 Link to this post

    Your sample works fine .... as expected.

    By explicitly calling the Rebind() method as the item is removed from the collection it works.  However, I'm not clear why it doesn't work automatically as the collection derives from ObservableCollection<T>.  Any clue what it could be? 

    Thanks.
    Dave
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 22 Mar 2012 Link to this post

    Hello David,

    Generally, groups are refreshed once CollectionChanged event is fired. 
    Could you update my project so that it corresponds to your settings and see whether you can get the same behavior on it ? Is there something that it is missing ? What is the data source that you are working with ? 

    All the best,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Dave Aronow
    Dave Aronow avatar
    7 posts
    Member since:
    Sep 2011

    Posted 21 May 2012 Link to this post

    After upgrading to the latest version of the controls this now works.  

Back to Top