objectlistview如何改变header组中的文字?
Objectlistview how to change the text in the group header?
我想更改组的名称 header 但我无法在文档或 google 上找到任何解决方案。
header中的文字应该是群里总结的时间
它应该是这样的:
the text in the header should be a time which is summed up in the group.
没问题:)
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);
}
};
我想更改组的名称 header 但我无法在文档或 google 上找到任何解决方案。
header中的文字应该是群里总结的时间
它应该是这样的:
the text in the header should be a time which is summed up in the group.
没问题:)
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);
}
};