|
this.sfDataGrid1.CellRenderers["CaptionSummary"] = new GridCaptionSummaryCellRendererExt();
public class GridCaptionSummaryCellRendererExt : GridCaptionSummaryCellRenderer
{
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
{
if (cellValue.Contains("Name"))
{
var dataRow = (DataRow)column.GetType().GetProperty("DataRow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(column);
Group group = dataRow.RowData as Group;
string ID = string.Empty;
int count = 0;
foreach (var record in group.Records)
{
if (ID == (record.Data as Data).ID)
continue;
ID = (record.Data as Data).ID;
count++;
}
cellValue = "Name : " + group.Key + "-" + count.ToString() + " " + "Items";
}
base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex);
}
} |