Cor*_*ana 6 c# listview sum objectlistview
我想更改组标题的名称,但我无法在文档或谷歌上找到任何解决方案.
标题中的文本应该是在组中总结的时间.
这是它应该是这样的:
标题中的文本应该是在组中总结的时间.
没问题 :)
olv.AboutToCreateGroups += delegate(object sender, CreateGroupsEventArgs args) {
foreach (OLVGroup olvGroup in args.Groups) {
int totalTime = 0;
foreach (OLVListItem item in olvGroup.Items) {
// change this block accordingly
MyRowObjectType rowObject = item.RowObject as MyRowObjectType;
totalTime += rowObject.MyNumericProperty;
// change this block accordingly
}
olvGroup.Header += String.Format(" (Total time = {0})", totalTime);
}
};
Run Code Online (Sandbox Code Playgroud)