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

AggregateFunction and converter

3 Answers 170 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bartosz
Top achievements
Rank 1
Bartosz asked on 14 Sep 2011, 11:37 AM
I have fallowing code:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Role, Converter={StaticResource conv}}" >
   <telerik:GridViewDataColumn.AggregateFunctions>
       <telerik:SumFunction Caption="sum:"  />
    </telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>

I cannot get this to work as AggregateFunction is not taking convert into account how I can change that ?

I am using latest release of telerik controls with .Net 4.

3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 19 Sep 2011, 12:57 PM
Hello Bartosz,

You can use AggregateFunction.ResultFormatString property. For more information you can take a look at this online example.
Let me know if this doesn't help.

All the best,
Nedyalko Nikolov
the Telerik team

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

0
anastasia
Top achievements
Rank 1
answered on 25 Apr 2017, 09:00 AM

Hello!!

I'd like to use AggregateFunction result for formatting like in demo example

something like:

<telerik:GridViewDataColumn
DataMemberBinding="{Binding WaitSecond, Converter={StaticResource SecondsToDateConverter}}"
DataFormatString="{}{0:HH:mm:ss}">

</telerik:GridViewDataColumn >

here WaitSecond is decimal, but it shows like Time

I need similar decision for AggregateFunction

Thanks!

0
Dilyan Traykov
Telerik team
answered on 28 Apr 2017, 06:57 AM
Hello ,

What I can suggest in this scenario is to define a custom template for the footer of your column and specify the converter for the binding of the FormattedValue property as demonstrated in this article.

    <telerik:GridViewDataColumn.Footer>
        <StackPanel Orientation="Vertical"
Margin="0,10">
            <TextBlock Text="Custom footer with aggregates:"
   Margin="0,0,0,2" />
            <telerik:AggregateResultsList ItemsSource="{Binding}"
                      VerticalAlignment="Center"
                      Grid.Column="4">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal"
                VerticalAlignment="Center">
                            <TextBlock VerticalAlignment="Center"
                   Text="{Binding Caption}" />
                            <TextBlock VerticalAlignment="Center"
                   Text="{Binding FormattedValue, Converter={StaticResource SecondsToDateConverter}}" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </telerik:AggregateResultsList>
        </StackPanel>
    </telerik:GridViewDataColumn.Footer>

Please let me know whether this would work for you.

Regards,
Dilyan Traykov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Bartosz
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
anastasia
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or