I want to change the name of the group header but i cant find any solutions in the documentation or on google.
the text in the header should be a time which is summed up in the group.
this is how it should look like:
I want to change the name of the group header but i cant find any solutions in the documentation or on google.
the text in the header should be a time which is summed up in the group.
this is how it should look like:
the text in the header should be a time which is summed up in the group.
No problem :)
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);
}
};
AboutToCreateGroups
is an ObjectListView event and is called before the groups are displayed. So you can actually make changes there to the groups that will directly reflect on the OLV. MyRowObjectType was just a placeholder for the underlying type of object that you use to populate the OLV. Access its Zeit
property there add add them up. –
Jubilant © 2022 - 2024 — McMap. All rights reserved.