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

[Solved] Footer template ?

3 Answers 221 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.
Ludovic Gerbault
Top achievements
Rank 1
Ludovic Gerbault asked on 12 Aug 2009, 07:31 AM
Hello,

I'm using a footer on some columns on my radgrid to display some informations about accounting.
The first column displays a stackpanel with two static textblocks (works fine)

But I'd like the other ones to display an aggregate function and a textblock , one above the other.

If the aggregate function works fine, I can't get the textblock to work properly.
it either displays right in front on the aggregate function, or doesn't diplay at all. I even had the case where the textblock removed the aggregate function.

Here's the code snippet for the xaml of the grid :

<grid:GridViewDataColumn HeaderText="Date échéance"
                                         DataFormatString="{}{0:d}"
                                         TextAlignment="Center"
                                         Width="Auto"
                                         DataMemberPath="dt_echeance" >
                    <grid:GridViewDataColumn.Footer>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="Solde : "
                                       VerticalAlignment="Top"/>
                            <TextBlock Text="Solde pointage : "
                                       VerticalAlignment="bottom"/>
                        </StackPanel>
                    </grid:GridViewDataColumn.Footer>
                </grid:GridViewDataColumn>
                <grid:GridViewDataColumn HeaderText="Débit"
                                         TextAlignment="Right"
                                         DataMemberPath="debit"
                                         Width="Auto" >
                    <grid:GridViewDataColumn.AggregateFunctions >
                        <data:SumFunction ResultFormatString="{}{0:c}"
                                          SourceField="debit" />
                    </grid:GridViewDataColumn.AggregateFunctions>
                    <grid:GridViewDataColumn.Footer>
                        <StackPanel Orientation="Vertical">
                            <gridView:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center" Grid.Column="4">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                                <TextBlock VerticalAlignment="Top" Text="{Binding FormattedValue}"  
                                                       HorizontalAlignment="Right"/>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                            </gridView:AggregateResultsList>
                            <TextBlock Text=" "
                                       VerticalAlignment="Bottom"/>
                        </StackPanel>
                    </grid:GridViewDataColumn.Footer>
                </grid:GridViewDataColumn>

The textblock must either be bind to a value, or initialized in code behind.

Thanks for your help

Ludovic

3 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 13 Aug 2009, 08:24 AM
Hello Subileau Pascal,

Please find attached a small sample which uses your code snipped with minor tweaks to accomplish what you wanted. Please note that the grid is bound in the code behind to ensure that all elements are loaded. If you bind it in XAML it is likely the aggregate in the footer will fire only after the you group the column. This is not exactly the behavior we want and we will be looking into this.

Sincerely yours,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rajesh Kumar
Top achievements
Rank 1
answered on 05 Jan 2010, 02:07 PM
Hi Kalin,

We are using a custom control in the Grid Cell Footer. It has a different item source/class to bind with. However, Same grid's row binding uses different collection.

It is possible to bind the different collection data to footer cell? If yes, can you please give me a sample?

Regards,
Rajesh
0
Kalin Milanov
Telerik team
answered on 07 Jan 2010, 12:29 PM
Hello Rajesh Kumar,

Since you are using a custom control you should be able to bind it to whatever collection you need. Its placement in the grid (group footers) should in no way affect the bindings in the user control.

All the best,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Ludovic Gerbault
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Rajesh Kumar
Top achievements
Rank 1
Share this question
or