devexpress gridview显示分组group文本
方案一
创建一个 Group Summary
C# 全选
gridView1.GroupSummary.Add(DevExpress.Data.SummaryItemType.Count, string.Empty);
方案二
另一种方法是处理 GridView.CustomDrawGroupRow 事件以提供您的自定义文本。要获得分组的行数,请使用 GridView.GetChildRowCount 方法。
C# 全选
private void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
{
GridView view = sender as GridView;
GridGroupRowInfo info = e.Info as GridGroupRowInfo;
string caption = info.Column.Caption;
if (info.Column.Caption == string.Empty)
caption = info.Column.ToString();
info.GroupText = string.Format("{0} : {1} (count= {2})", caption, info.GroupValueText, view.GetChildRowCount(e.RowHandle));
}
参考:
How to show a group row count in a grid | DevExpress Support
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
post 张国生