This question is locked. New answers and comments are not allowed.
I am sure I have coded something incorrectly but I am incapable of figuring it out:
The code I am about to post exhibits the following problems:
1) Column totals don't show up at all
2) Footer is not right justified ( in the grand total that does show up )
I have loaded and inspected the example Vlad posted here: SilverlightApplication2 and the application works just fine for me. I have to be missing some key component but I just cannot discover it.
Here is the grid XAML:
| <telerikGridView:RadGridView AutoGenerateColumns="False" x:Name="cGrid" |
| ShowGroupPanel="False" |
| CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" |
| ShowGroupFooters="True" ShowColumnFooters="True"> |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn HeaderText="Asset" UniqueName="AssetName" Width="200" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Cusip" UniqueName="Cusip" Width="Auto"/> |
| <telerikGridView:GridViewDataColumn HeaderText="Shares" UniqueName="Shares" Width="Auto" TextAlignment="Right" /> |
| <telerikGridView:GridViewDataColumn HeaderText="MarketValue" UniqueName="MarketValue" Width="Auto" TextAlignment="Right" /> |
| </telerikGridView:RadGridView.Columns> |
| <telerikGridView:RadGridView.GroupDescriptors> |
| <telerikData:GroupDescriptor Member="ReportType" SortDirection="Ascending" /> |
| </telerikGridView:RadGridView.GroupDescriptors> |
| </telerikGridView:RadGridView> |
And here is where I actually create the aggregate functions and assign their properties:
| foreach (var externalColumn in e.Result.ExternalDataColumns) |
| { |
| switch (externalColumn.ColumnName.ToLower()) |
| { |
| case "marketvalue": |
| { |
| var col = cGrid.Columns["MarketValue"] as GridViewDataColumn; |
| Debug.Assert( col != null, "Columns[MarketValue] is null."); |
| if ( col != null ) |
| { |
| var sum = new SumFunction(); |
| sum.ResultFormatString = externalColumn.FormatString; |
| sum.SourceField = "MarketValue"; |
| col.DataFormatString = externalColumn.FormatString; |
| col.FooterTextAlignment = TextAlignment.Right; |
| col.AggregateFunctions.Add( sum ); |
| } |
| } |
| break; |
| case "shares": |
| { |
| var col = cGrid.Columns["Shares"] as GridViewDataColumn; |
| Debug.Assert(col != null, "Columns[Shares] is null."); |
| if (col != null) |
| { |
| var sum = new SumFunction(); |
| sum.ResultFormatString = externalColumn.FormatString; |
| sum.SourceField = "Shares"; |
| col.DataFormatString = externalColumn.FormatString; |
| col.FooterTextAlignment = TextAlignment.Right; |
| col.AggregateFunctions.Add(sum); |
| } |
| } |
| break; |
| } |
| } |
That is about it for the entire user control other than showing how I got the data back from the wcf server.
Here is what I get displayed: Grid Snapshot
