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

How can you detect if the GroupHeader was clicked?

4 Answers 131 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jholt
Top achievements
Rank 1
jholt asked on 07 Dec 2010, 05:41 PM
I have two identical  WPF RadGridViews on my form. I want to be able to detect when the GroupHeader has been clicked so that
a) Only one group on each grid is expanded at any one time
b) If the group in radGridDebits is expanded/collapsed, the same group in radGridCredits is expanded/collapsed - i.e. synchronize the group header between both grids.
c) Basically, I'm looking for a GroupHeader.Clicked event but can't find it!!

<Controls1:RadGridView Grid.Row="1"
                            x:Name="radGridDebits"
                            AutoGenerateColumns="False"
                            ShowColumnHeaders="False"
                            IsReadOnly="True"
                            ItemsSource="{Binding Data}"
                            ShowGroupPanel="False"
                            RowIndicatorVisibility="Collapsed"
                            AutoExpandGroups="False">
         <Controls1:RadGridView.SortDescriptors>
             <Data:SortDescriptor Member="HlpAccountGroup.CategoryID" />
             <Data:SortDescriptor Member="Description" />
         </Controls1:RadGridView.SortDescriptors>
         <Controls1:RadGridView.GroupDescriptors>
             <Data:GroupDescriptor Member="HlpGroupCompany.Description"
                                   DisplayContent="Group company"
                                   SortDirection="Ascending" />
         </Controls1:RadGridView.GroupDescriptors>
         <Controls1:RadGridView.FilterDescriptors>
             <Data:CompositeFilterDescriptorCollection>
                 <Data:CompositeFilterDescriptor LogicalOperator="Or">
                     <Data:FilterDescriptor Member="HlpAccountGroup.AccountType"
                                            Value="Debit" />
                     <Data:FilterDescriptor Member="HlpAccountGroup.AccountType"
                                            Value="Common" />
                 </Data:CompositeFilterDescriptor>
             </Data:CompositeFilterDescriptorCollection>
         </Controls1:RadGridView.FilterDescriptors>
         <Controls1:RadGridView.GroupHeaderTemplate>
             <DataTemplate>
                 <Border Background="{Binding Group.Items[0].HlpGroupCompany.Brush}"
                         Padding="3"
                         Width="250"
                         CornerRadius="3"
                         BorderThickness="1">
                     <StackPanel Orientation="Horizontal">
                         <TextBlock Text="Group company:"
                                    Margin="0,0,3,0" />
                         <TextBlock Text="{Binding Group.Key}"
                                    Foreground="{StaticResource DarkBackground}"
                                    FontWeight="Bold" />
                     </StackPanel>
                 </Border>
             </DataTemplate>
         </Controls1:RadGridView.GroupHeaderTemplate>
         <Controls1:RadGridView.Columns>
             <Controls1:GridViewDataColumn Header="Account"
                                           DataMemberBinding="{Binding Description}" />
             <Controls1:GridViewDataColumn Header=""
                                           DataMemberBinding="{Binding HlpCurrency.CurrencyId}" />
         </Controls1:RadGridView.Columns>
     </Controls1:RadGridView>
 
 
 
 
 
<Controls1:RadGridView Grid.Row="1"
                            x:Name="radGridCredits"
                            AutoGenerateColumns="False"
                            ShowColumnHeaders="False"
                            IsReadOnly="True"
                            ItemsSource="{Binding Data}"
                            ShowGroupPanel="False"
                            RowIndicatorVisibility="Collapsed"
                            AutoExpandGroups="False">
         <Controls1:RadGridView.SortDescriptors>
             <Data:SortDescriptor Member="HlpAccountGroup.CategoryID" />
             <Data:SortDescriptor Member="Description" />
         </Controls1:RadGridView.SortDescriptors>
         <Controls1:RadGridView.GroupDescriptors>
             <Data:GroupDescriptor Member="HlpGroupCompany.Description"
                                   DisplayContent="Group company"
                                   SortDirection="Ascending" />
         </Controls1:RadGridView.GroupDescriptors>
         <Controls1:RadGridView.FilterDescriptors>
             <Data:CompositeFilterDescriptorCollection>
                 <Data:CompositeFilterDescriptor LogicalOperator="Or">
                     <Data:FilterDescriptor Member="HlpAccountGroup.AccountType"
                                            Value="Credit" />
                     <Data:FilterDescriptor Member="HlpAccountGroup.AccountType"
                                            Value="Common" />
                 </Data:CompositeFilterDescriptor>
             </Data:CompositeFilterDescriptorCollection>
         </Controls1:RadGridView.FilterDescriptors>
         <Controls1:RadGridView.GroupHeaderTemplate>
             <DataTemplate>
                 <Border Background="{Binding Group.Items[0].HlpGroupCompany.Brush}"
                         Padding="3"
                         Width="250"
                         CornerRadius="3"
                         BorderThickness="1">
                     <StackPanel Orientation="Horizontal">
                         <TextBlock Text="Group company:"
                                    Margin="0,0,3,0" />
                         <TextBlock Text="{Binding Group.Key}"
                                    Foreground="{StaticResource DarkBackground}"
                                    FontWeight="Bold" />
                     </StackPanel>
                 </Border>
             </DataTemplate>
         </Controls1:RadGridView.GroupHeaderTemplate>
         <Controls1:RadGridView.Columns>
             <Controls1:GridViewDataColumn Header="Account"
                                           DataMemberBinding="{Binding Description}" />
             <Controls1:GridViewDataColumn Header=""
                                           DataMemberBinding="{Binding HlpCurrency.CurrencyId}" />
         </Controls1:RadGridView.Columns>
     </Controls1:RadGridView>

Many thanks
Jeremy Holt

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Dec 2010, 06:30 PM
Hello jholt,

You may try to use the two events raised once a particular group is being expanded or collapsed:

private void gridView_GroupRowIsExpandedChanging(object sender, GroupRowCancelEventArgs e)
{
}
private void gridView_GroupRowIsExpandedChanged(object sender, GroupRowEventArgs e)
{
}
 
However, those events are available in our Latest Internal Build.

Kind regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
jholt
Top achievements
Rank 1
answered on 07 Dec 2010, 11:53 PM
Hi Maya,

Just downloaded the latest internal build. Perfect!!!

Thank you very much.

Regards
Jeremy
0
Arpit
Top achievements
Rank 1
answered on 08 Mar 2011, 09:00 AM
Can you please suggest from where i can get this dll.
I am also facing the same issues.
0
Maya
Telerik team
answered on 08 Mar 2011, 09:06 AM
Hello jholt,

You may download the Latest Internal Build from your Telerik account. However, the mentioned events are available in our official versions as well since the Q3 2010 SP1 release.

 

Kind regards,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
jholt
Top achievements
Rank 1
Answers by
Maya
Telerik team
jholt
Top achievements
Rank 1
Arpit
Top achievements
Rank 1
Share this question
or