The DataGridColumn.GroupRowHeaderTemplate is great. I'm wondering if it would be possible to have a GroupCellTemplate or something similar on the DataGridColumn. I'm wanting to have a different template for each column and have its content displayed underneath the column (in the cell). For example, I'd like to have totals or averages or both displayed for each column on the "GroupRowHeader" but I'd like the data to line up underneath the column. So one thought would be to have each column control its own cell for when the data is grouped. Then, just as the DataGridGroupingRow has a DataGridGroup and in turn a collection of children (items from ItemsSource collection within the particular group), I'd like to be able to access the collection of items to calculate a total, average, count or perform any other calculation and present the results in the cell. Please see the attached image. Let me know if you have any ideas. Thanks!
Also, along with the previous request, I'd like to know how to best provide overall summary values (totals, averages, etc.). Do I need to calculate those things beforehand and modify the ItemsSource collection? I'd rather not modify the ItemsSource collection. I wonder if we could set a flag to state whether or not we want an overall summary row or not, then maybe the GroupCellTemplate from the previous post could be utilized for the overall summary cells (or provide another template for the overall summary).? I would think that these issues would be very common across your customer base. I know we run into these issues with almost all the grids we provide in our programs. Thanks for all you do!
Status: Completed
|
Thank you all for posting this suggestion and thanks for your patience. WPF Elements now includes the following built in aggregates: count, sum, minimum, maximum, average and mode (most common value). The new DataGridColumn.FooterAggregate and DataGridColumn.GroupAggregate properties allow you to specify an aggregate for particular columns to appear in the footer or group headers. The aggregates are automatically updated and line up with the columns that you set them on. (Make sure to also set DataGrid.IsFooterVisible if you want to display the footer). You can also set the FooterTemplate and GroupHeaderCellTemplate properties on each DataGridColumn. This can be used to either override the way aggregate results are displayed, or to display whatever you want in the footer/group headers regardless of the aggregates feature. You can also implement your own aggregates if you need to. Let me know if you need help doing this. For a more detailed explanation of using these features, check out this blog post: http://www.mindscapehq.com/blog/index.php/2013/09/04/wpf-datagrid-footer-and-aggregates/ Feel free to post more comments on this thread for questions or additional feature requests related to DataGrid aggregates. Jason Fauchelle |
|
|