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

FirstFunction Display Property

1 Answer 109 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.
Daniel Knoll
Top achievements
Rank 1
Daniel Knoll asked on 15 Jun 2012, 06:40 AM
Hi,

I'm using the RadGridView with AggregateFunctions. I have aggregated Sums of specific columns. Now I want to have the Text of one column to appear next to the aggregates. For this purpose I use the FirstFunction on the column I want to appear.

The problem is, I get the whole row bound to the column and it seems like the ToString() method of the DataContext of the row is called. But I want a specific property of the row bound to my column. Usually you want to bind the same property as the Column where the function is defined. I use a GridViewComboBoxColumn for this column.

Here is my code:
<telerik:GridViewDataColumn Header="Preis" DataFormatString="N2" DataMemberBinding="{Binding Path=Price}" TextAlignment="Right" MinWidth="100">
    <telerik:GridViewDataColumn.AggregateFunctions>
        <telerik:SumFunction ResultFormatString="{}{0:N2}" />
    </telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
<telerik:GridViewComboBoxColumn ItemsSource="{Binding Path=DataContext.Currencies, ElementName=root}" MinWidth="100" Header="Währung" DataMemberBinding="{Binding Path=Currency}">
    <telerik:GridViewComboBoxColumn.AggregateFunctions>
        <telerik:FirstFunction />
    </telerik:GridViewComboBoxColumn.AggregateFunctions>
</telerik:GridViewComboBoxColumn>

I need a DisplayProperty in the FirstFunction, so I can bind to "Currency" of the row.

Greets

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 15 Jun 2012, 07:39 AM
Hello,

What you can do is create a custom aggregate function. This gives you the freedom to return anything.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Daniel Knoll
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or