//Creating Summary Columns
GridSummaryColumn summaryColumn1 = new GridSummaryColumn();
summaryColumn1.Name = "OrderID";
summaryColumn1.SummaryType = SummaryType.CountAggregate;
summaryColumn1.Format = "{Count}";
summaryColumn1.MappingName = "OrderID";
GridSummaryColumn summaryColumn2 = new GridSummaryColumn();
summaryColumn2.Name = "Price";
summaryColumn2.SummaryType = SummaryType.DoubleAggregate;
summaryColumn2.Format = "{Sum}";
summaryColumn2.MappingName = "UnitPrice";
GridSummaryColumn summaryColumn3 = new GridSummaryColumn();
summaryColumn3.Name = "Quantity";
summaryColumn3.SummaryType = SummaryType.DoubleAggregate;
summaryColumn3.Format = "{Average}";
summaryColumn3.MappingName = "Quantity";
//TableSummary Row
GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow();
tableSummaryRow1.Name = "TableSummary";
tableSummaryRow1.ShowSummaryInRow = true;
tableSummaryRow1.Title = " Table Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}";
tableSummaryRow1.Position = VerticalPosition.Bottom;
tableSummaryRow1.SummaryColumns.Add(summaryColumn1);
tableSummaryRow1.SummaryColumns.Add(summaryColumn2);
tableSummaryRow1.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.TableSummaryRows.Add(tableSummaryRow1);
//GroupSummary Row
GridSummaryRow groupSummaryRow1 = new GridSummaryRow();
groupSummaryRow1.Name = "GroupSummary";
groupSummaryRow1.ShowSummaryInRow = true;
groupSummaryRow1.Title = "Group Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}";
groupSummaryRow1.SummaryColumns.Add(summaryColumn1);
groupSummaryRow1.SummaryColumns.Add(summaryColumn2);
groupSummaryRow1.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.GroupSummaryRows.Add(tableSummaryRow1);
//CaptionSummary Row
GridSummaryRow captionSummaryRow = new GridSummaryRow();
captionSummaryRow.Name = "CaptionSummary";
captionSummaryRow.ShowSummaryInRow = true;
captionSummaryRow.Title = "Caption Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}";
captionSummaryRow.SummaryColumns.Add(summaryColumn1);
captionSummaryRow.SummaryColumns.Add(summaryColumn2);
captionSummaryRow.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.CaptionSummaryRow = captionSummaryRow; |
//Creating Summary Columns
GridSummaryColumn summaryColumn1 = new GridSummaryColumn();
summaryColumn1.Name = "OrderID";
summaryColumn1.SummaryType = SummaryType.CountAggregate;
summaryColumn1.Format = "{Count}";
summaryColumn1.MappingName = "OrderID";
GridSummaryColumn summaryColumn2 = new GridSummaryColumn();
summaryColumn2.Name = "Price";
summaryColumn2.SummaryType = SummaryType.DoubleAggregate;
summaryColumn2.Format = "{Sum}";
summaryColumn2.MappingName = "UnitPrice";
GridSummaryColumn summaryColumn3 = new GridSummaryColumn();
summaryColumn3.Name = "Quantity";
summaryColumn3.SummaryType = SummaryType.DoubleAggregate;
summaryColumn3.Format = "{Average}";
summaryColumn3.MappingName = "Quantity";
//TableSummary Row
GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow(
tableSummaryRow1.Name = "TableSummary";
tableSummaryRow1.ShowSummaryInRow = false;
tableSummaryRow1.Position = VerticalPosition.Bottom;
tableSummaryRow1.SummaryColumns.Add(summaryColumn1);
tableSummaryRow1.SummaryColumns.Add(summaryColumn2);
tableSummaryRow1.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.TableSummaryRows.Add(tableSummaryRow1);
//GroupSummary Row
GridSummaryRow groupSummaryRow1 = new GridSummaryRow();
groupSummaryRow1.Name = "GroupSummary";
groupSummaryRow1.ShowSummaryInRow = false;
groupSummaryRow1.SummaryColumns.Add(summaryColumn1);
groupSummaryRow1.SummaryColumns.Add(summaryColumn2);
groupSummaryRow1.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.GroupSummaryRows.Add(tableSummaryRow1);
//CaptionSummary Row
GridSummaryRow captionSummaryRow = new GridSummaryRow();
captionSummaryRow.Name = "CaptionSummary";
captionSummaryRow.ShowSummaryInRow = false;
captionSummaryRow.SummaryColumns.Add(summaryColumn1);
captionSummaryRow.SummaryColumns.Add(summaryColumn2);
captionSummaryRow.SummaryColumns.Add(summaryColumn3);
this.sfDataGrid.CaptionSummaryRow = captionSummaryRow; |