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

RadGridView GroupHeaderTemplate will not disappear when group is empty

4 Answers 191 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dave Aronow
Top achievements
Rank 1
Dave Aronow asked on 20 Mar 2012, 08:50 PM
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>

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 21 Mar 2012, 10:00 AM
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 >>
0
Dave Aronow
Top achievements
Rank 1
answered on 21 Mar 2012, 11:51 PM
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
0
Maya
Telerik team
answered on 22 Mar 2012, 09:50 AM
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 >>
0
Dave Aronow
Top achievements
Rank 1
answered on 21 May 2012, 02:29 PM
After upgrading to the latest version of the controls this now works.  

Tags
GridView
Asked by
Dave Aronow
Top achievements
Rank 1
Answers by
Maya
Telerik team
Dave Aronow
Top achievements
Rank 1
Share this question
or