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

Column Caption in Group Header

2 Answers 163 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jani
Top achievements
Rank 1
Jani asked on 10 May 2011, 09:21 AM
Hi

Is it possible to add the column caption in customized XAML GroupHeaderTemplate (without code behind).

The output should be
  {ColumnCaption}: {Group.Key} - {Group.ItemCount} Items

Example:
  Product: MyProduct - 78 Items

Cheers,
Jani

2 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 10 May 2011, 09:31 AM
Hi Jani,

 

You may achieve the desired result by predefining the GroupHeaderTemplate, as shown below:

<telerik:RadGridView  ItemsSource="{Binding Collection}">
            <telerik:RadGridView.GroupHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding GroupDescriptor.Member}"/>
                        <TextBlock Text=":"/>
                        <TextBlock Text="{Binding Group.Key}"/>
                        <TextBlock Text="{Binding Group.ItemCount}"/>
                        </StackPanel>
                    </DataTemplate>
                </telerik:RadGridView.GroupHeaderTemplate>
                <telerik:RadGridView.GroupDescriptors>
                    <telerik:GroupDescriptor Member="Property1"/>
                    </telerik:RadGridView.GroupDescriptors>
            </telerik:RadGridView>


You may read more about Grouping in our online documentation, please follow this link. 

Greetings,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jani
Top achievements
Rank 1
answered on 10 May 2011, 09:56 AM
Hi Vanja,

Many thanks for the quick response!

I'm using instead of GroupDescriptor.Member the value of Column.Header.

Cheers,
Jani
Tags
GridView
Asked by
Jani
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Jani
Top achievements
Rank 1
Share this question
or