GridSummaryItem.FieldName Property
Gets or sets the name of a dataset field whose values are used for summary calculation.
Namespace: DevExpress.XtraGrid
Assembly:
DevExpress.XtraGrid.v17.2.dll
Declaration
[TypeConverter("DevExpress.XtraGrid.TypeConverters.FieldNameTypeConverter, DevExpress.XtraGrid.v17.2.Design")]
[XtraSerializableProperty(1)]
public virtual string FieldName { get; set; }
<XtraSerializableProperty(1)>
<TypeConverter("DevExpress.XtraGrid.TypeConverters.FieldNameTypeConverter, DevExpress.XtraGrid.v17.2.Design")>
Public Overridable Property FieldName As String
Property Value
Type |
Description |
String |
A string value specifying the name of a data field whose values are used for summary calculation.
|
If the GridSummaryItem.SummaryType property value is SummaryItemType.Count, you can leave the FieldName property set to an empty string (or set to any other value). If the GridSummaryItem.SummaryType property value is SummaryItemType.Custom, setting the FieldName property value is optional. If you want to use the GridView.CustomSummaryCalculate event’s CustomSummaryEventArgs.FieldValue parameter, you must initialize the FieldName property with the required field name. If you don’t want to use the this parameter, the FieldName property can be set to any value.
If the GridSummaryItem.SummaryType property is set to SummaryItemType.Min, SummaryItemType.Max, SummaryItemType.Sum or SummaryItemType.Average, the FieldName property must specify the name of a field bound to the column whose values must be used when calculating. Otherwise, no summary will be calculated.
The following code snippets (auto-collected from DevExpress Examples) contain references to the FieldName property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
how-to-separately-calculate-a-group-summary-for-a-particular-group-row-e383/VB/Form1.vb#L38
If e.SummaryProcess = CustomSummaryProcess.Calculate Then
If CType(e.Item, GridGroupSummaryItem).FieldName = "HP" Then
If e.GroupRowHandle Mod 2 = 0 Then
how-to-show-multiple-group-summary-items-in-the-same-group-footer-cell-in-bandedgridview-e4900/VB/Form1.vb#L41
Private Sub AddSummaries(ByVal view As BandedGridView)
view.GroupSummary.AddRange(New GridSummaryItem() { New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Count, .FieldName = "Data", .ShowInGroupColumnFooter = view.Columns("Data"), .DisplayFormat = "Count data = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Max, .FieldName = "Date", .ShowInGroupColumnFooter = view.Columns("Date"), .DisplayFormat = "Max date = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Min, .FieldName = "Date", .ShowInGroupColumnFooter = view.Columns("Date"), .DisplayFormat = "Min date = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Count, .FieldName = "Date", .ShowInGroupColumnFooter = view.Columns("Date"), .DisplayFormat = "Count date = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Average, .FieldName = "Int", .ShowInGroupColumnFooter = view.Columns("Int"), .DisplayFormat = "Avg int = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Sum, .FieldName = "Int", .ShowInGroupColumnFooter = view.Columns("Int"), .DisplayFormat = "Sum int = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Count, .FieldName = "Int", .ShowInGroupColumnFooter = view.Columns("Int"), .DisplayFormat = "Count int = {0}"}, New GridGroupSummaryItem() With {.SummaryType = SummaryItemType.Count, .FieldName = "String", .ShowInGroupColumnFooter = view.Columns("String"), .DisplayFormat = "Count string = {0}"} })
End Sub
how-to-show-tooltips-for-summaries-displayed-in-a-group-row-e3195/VB/GroupRowSummaryHelper.vb#L47
Dim text As String = item.GetDisplayText(values(item), False)
rect = CalcSummaryRect(text, e, view.Columns(item.FieldName))
e.Appearance.DrawString(e.Cache, text, rect)
how-to-show-multiple-group-summary-values-in-the-same-group-footer-cell-e3607/VB/MultiGroupSummary/MyGridControl/MyGridView.vb#L87
If summaryItem IsNot Nothing Then
fieldName = summaryItem.FieldName
showInGroupColumnFooter = summaryItem.ShowInGroupColumnFooter
how-to-print-group-summary-values-under-corresponding-columns-e2084/VB/Q250602/MyGridControl.vb#L94
Dim summaryBrick As ITextBrick = CType(DrawTextBrick(graph, summaryText, groupCellBounds, False), ITextBrick)
If summary IsNot Nothing AndAlso View.Columns(summary.FieldName).VisibleIndex = 0 Then
summaryBrick.HorzAlignment = HorzAlignment.Far
See Also