The documentation is whoefully lacking when it comes to the grid footer. Are there any samples or documentation pertaining to summerizing columns in the footer?
Thanks
Stephen,
That worked, thanks for the quick response. So here is the final code for anyone else in this boat.
gridAccountSummary.Columns.DataColumns[
));
Hey Brad,
You can access a Column directly, without going through the rows.
grid.Columns.DataColumns[0].FooterText = ...
or by key
grid.Columns.DataColumns["Debits"].FooterText = ...
or through the columns collection directly:
((Column)grid.Columns[0]).FooterText = ...
((Column)grid.Columns["Debits"]).FooterText = ...
-SteveZ
I did get it to work, I suppose it's a hack of sorts, but until 9.2 this will work. I essentially summed the values and set the footer text as suggested but only if there are rows in the grid. I use the first row in the collection to set the footer text, since it seems the only way to access it is via the row->cells collection.
Here is the code that is working:
gridAccountSummary.ItemsSource = _model.Summary;
(_model.Summary.Count <= 0)
;
gridAccountSummary.Rows[0].Cells[1].Column.FooterText =
gridAccountSummary.Rows[0].Cells[2].Column.FooterText =
gridAccountSummary.Rows[0].Cells[3].Column.FooterText =
Brad
Hi Brad,
So, Rows will be loaded into the grid when the ItemsSource is set, or if the ItemsSource is set before the control is loaded, it will be loaded in the xamWebGrid's loaded event.
However, since you have access to the ItemsSource, you can simply traverse your data directly, and avoid the using the Grid's Rows collection. Then simply use the Column.FooterText property to have your summary information.
Hope this helps clarify what Devin was suggesting.
Devin,
That answer really didn't help, it appears that in the grids loaded event is fired before the rows are in the rows collection. Of the initailize row is not an option either. So I'm stuck right now unlesss there is a concrete way to generate sums in the footers correctly.