Objectlistview如何更改组标题中的文本? [英] Objectlistview how to change the text in the group header?

查看:69
本文介绍了Objectlistview如何更改组标题中的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改组标题的名称,但在文档或Google上找不到任何解决方案.

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.

它应该是这样的:

推荐答案

标题中的文本应该是在该组中汇总的时间.

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);
    }
};

这篇关于Objectlistview如何更改组标题中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆