如何通过 MVVM 在 WPF 数据网格中实现汇总行(总行数)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28824573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 12:59:19  来源:igfitidea点击:

How to implement summary rows(Total rows) in WPF data-grid via MVVM

c#wpfmvvmrowsummary

提问by Anupa Manujith Rajapaksha

I need a help to to make a summary row or total a row in WPF datagrid using MVVM pattern, special of this summary row is having a value for each column like a image shows below.First total calculation base on first 3 items and those are in one group.I couldn't find a good example or sample code for this issue.

我需要帮助使用 MVVM 模式在 WPF 数据网格中制作汇总行或总计一行,此汇总行的特殊之处在于每列都有一个值,如下图所示。第一次总计算基于前 3 个项目,这些是在一组中。我找不到这个问题的好例子或示例代码。

Please refer this image:

请参考这张图片:

enter image description here

在此处输入图片说明

回答by Muds

you can add a footer row to your datagrid like Thisor like This

您可以像This或 like This一样向数据网格添加页脚行

-- updated --

- 更新 -

if you need row Grouping have a look Here.. try to understand the concept of grouping and adding row group headers

如果您需要行分组,请看这里.. 尝试了解分组和添加行组标题的概念