private GroupDisplayEventArgs GetDisplayValues(DataGridViewRowPrePaintEventArgs pe) { IGroupRow row = source[pe.RowIndex] as IGroupRow; GroupDisplayEventArgs e = new GroupDisplayEventArgs(row, source.GroupOn); bool selected = selectedrows.Contains(pe.RowIndex); e.Selected = selected; e.SelectionBackColor = selected ? grid.DefaultCellStyle.SelectionBackColor : grid.DefaultCellStyle.BackColor; e.SelectionForeColor = selected ? grid.DefaultCellStyle.SelectionForeColor : grid.DefaultCellStyle.ForeColor; e.Font = pe.InheritedRowStyle.Font; if (showcount) { e.Summary = "(" + row.Count + ")"; } if (showheader) { e.Header = source.GroupOn.ToString(); } e.GroupingInfo.SetDisplayValues(e); if (e.Cancel) { return(null); } if (DisplayGroup != null) { DisplayGroup(this, e); if (e.Cancel) { return(null); } } return(e); }
public virtual void SetDisplayValues(GroupDisplayEventArgs e) { var o = e.Value; e.DisplayValue = o == null ? "<Null>" : o.ToString(); }