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

Add Header to Group Caption

1 Answer 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 18 Apr 2017, 05:33 PM
we are currently using the following to initialize grouping:
 
<tk:GridViewColumn.AggregateFunctions>
    <tk:CountFunction ResultFormatString="{}{0} Items" />
</tk:GridViewColumn.AggregateFunctions>

 

Several items that we group by just return numbers, it does not make a lot of since as to what exactly is being grouped we get headers like 234 236 Items

 

We would like to be able to do something like this: 

<tk:GridViewColumn.AggregateFunctions>
    <tk:CountFunction ResultFormatString="{}{1}:{2} - {0} Items" />
</tk:GridViewColumn.AggregateFunctions>

Where we get something like this  Product Code: 234 - 236 Items

1 ==  Header == Product Code
2 ==  Value    == 234
3==   Count   ==236

Is this possible?

1 Answer, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 18 Apr 2017, 07:44 PM

Was able to figure out a solution:

 

<DataTemplate  x:Key="defaultRadGridViewGroupHeaderTemplate">
    <TextBlock>
        <Run Text="{Binding Column.Header, Mode=OneWay}" />: <Run Text="{Binding Group.Key, Mode=OneWay, TargetNullValue=\{emtpy\}}" FontWeight="Bold" /> (<Run Text="{Binding Group.ItemCount, Mode=OneWay}" /> Items)
    </TextBlock>
</DataTemplate>
Tags
GridView
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Share this question
or