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

FooterTextAlignment with multiple AggregateFunctions

3 Answers 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 21 Aug 2014, 08:14 PM
I have a grid whose columns have multiple AggregateFunctions. The FooterTextAlignment for each column is set to Right, which results in the situation seen in the attached image. Seems like the footer cell itself is aligned to the right, but each line of text that corresponds to an aggregate result is left aligned within the cell. Is there a way to make all of the aggregate results right aligned?

3 Answers, 1 is accepted

Sort by
0
Accepted
Boris
Telerik team
answered on 22 Aug 2014, 02:11 PM
Hello Robert,

A possible way to right align the result text of the aggregate functions is to redefine the Footer property of the GridViewColumn. In order to affect how each aggregate result is displayed, you will need to use the AggregateResultsList and define a new DataTemplate for its ItemTemplate property. For example you can define a TextBlock and set its TextAlignment property to "Right":

<telerik:GridViewDataColumn.Footer>                    
    <telerik:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center" >
        <ItemsControl.ItemTemplate>
            <DataTemplate>                                     
                <TextBlock VerticalAlignment="Center" Text="{Binding FormattedValue}" TextAlignment="Right" />                                     
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </telerik:AggregateResultsList>                    
</telerik:GridViewDataColumn.Footer>

I attached a sample project that demonstrates the suggested approach.

Please examine it and let us know how it goes.

Regards,
Boris Penev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Robert
Top achievements
Rank 1
answered on 22 Aug 2014, 02:57 PM
Thanks, that works. Is there a reason that that's not the default functionality of setting FooterTextAlignment = TextAlignment.Right?
0
Boris
Telerik team
answered on 22 Aug 2014, 03:33 PM
Hi Robert,

In general the setting the FooterTextAlignment property of the GridViewColumn to TextAlignment.Right is meant to only move to the right the control containing the aggregate functions and not its content. The aggregate result is displayed via TextBlock and its TextAlignment property by default is set to "TextAlignment.Left".

I hope this helps.

Regards,
Boris Penev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Robert
Top achievements
Rank 1
Answers by
Boris
Telerik team
Robert
Top achievements
Rank 1
Share this question
or