Xceed Grid for WinForms v4.3 Documentation
TextFormat Property (SummaryRow)
Example 


Xceed.Grid.v4.3 Assembly > Xceed.Grid Namespace > SummaryRow Class : TextFormat Property
Gets or sets a string used to dynamically create the SummaryRow's Text.
Syntax
'Declaration
 
<DescriptionAttribute("A string used to dynamically create the SummaryRow's text.")>

<CategoryAttribute("Appearance")>

<LocalizableAttribute(True)>

<ApplyToDesignerAttribute(True)>

Public Property TextFormat As String
'Usage
 
Dim instance As SummaryRow

Dim value As String

 

instance.TextFormat = value

 

value = instance.TextFormat
[Description("A string used to dynamically create the SummaryRow's text.")]

[Category("Appearance")]

[Localizable(true)]

[ApplyToDesigner(true)]

public string TextFormat {get; set;}

Property Value

A string used to dynamically create the SummaryRow's Text. By default, DefaultTextFormat.

The following table provides a list of the supported variables and their definitions.

Note: Variables must be preceded and followed by a % symbol. See below for a usage example.

Supported variables Descriptions
%GROUPBYCOLUMNFIELDNAME% The Column.FieldName of the column as defined by the parent group's GroupBy property.
%GROUPBYCOLUMNTITLE% The Column.Title of the column represented by the parent group's GroupBy property.
%GROUPKEY% The Key of the parent group.
%GROUPTITLE% The Title of the parent group.
%DATAROWCOUNT% The number of datarows in the parent group.
%COUNT: (see below for usage)% The result of the Count statistical function.
%MAX: (see below for usage)% The result of the Maximum statistical function.
%MIN: (see below for usage)% The result of the Minimum statistical function.
%SUM: (see below for usage)% The result of the Sum statistical function.
%AVG: (see below for usage)% The result of the Average statistical function.
%STDEV: (see below for usage)% The result of the Standard Deviation statistical function.
%STDEVP: (see below for usage)% The result of the Standard Deviation Population statistical function.
%VAR: (see below for usage)% The result of the Variance statistical function.
%VARP: (see below for usage)% The result of the Variance Population statistical function.
%MEDIAN: (see below for usage)% The result of the Median statistical function.
%MODE: (see below for usage)% The result of the Mode statistical function.
%GEOMEAN: (see below for usage)% The result of the Geometric Mean statistical function.
%HARMEAN: (see below for usage)% The result of the Harmonic Mean statistical function.
%RMS: (see below for usage)% The result of the Root Mean Square statistical function.

In the case of the variables that represent StatFunctions (COUNT, MAX, MIN, SUM, AVG, STDEV, STDEVP, VAR, VARP, MEDIAN, MODE, GEOMEAN, HARMEAN, and RMS), additional parameters must be provided within the variable after the colon (:). These parameters are the fieldname of the column from which the data is retrieved, the (optional) format specifier with which the result of the statistical function is displayed, and the (optional) group level for which the statistical function is calculated.

%COUNT: ["]column_fieldname["] [ format=["]format_specifier["] ] [ level=running_stat_group_level ]%

All items placed in square brackets [] are optional. If the column_fieldname and/or format_specifier parameters contain spaces, quotes must be used. If a running_stat_group_level is not specified, -1 (current group) is assumed. Example 1 below demonstrates how to set the TextFormat property using statistical function variables.

The format of a mathematical function depends on 2 things: the function itself and the datatype of the column whose values are used for the statistical function.

The following table provides a list of supported and unsupported format specifiers relative to the datatype of the column whose values are used for the statistical function.

Statistical function Column datatype Datatype sent to the format specifier Unsupported format specifiers
COUNT Any Int64 R
MAX, MIN, MODE Anything that implements the IComparable interface. Always the same as the datatype of the column specified by the column_fieldname parameter.
SUM Integral type* Int64 R
Floating point types** Double D and X
Decimal Decimal D, X and R
AVG, VAR, VARP, HARMEAN Integral* and Floating point** types Double D and X
Decimal Decimal D, X and R
STDEV, STDEVP, GEOMEAN, RMS Integral*, Floating point**, and Decimal types Double D and X
MEDIAN Integral type* (even item count) Double D and X
Integral type* (odd item count) Int64 R
Floating point types** Double D and X
Decimal Decimal D, X and R

* Integral types : Byte, SByte, Char, Int16, UInt16, Int32, UInt32, Int64, UInt64

** Floating point types: Single and Double

The values are rounded in the same manner as the string.Format round, meaning a banker's round.

Hint: You can use F0 instead of D. It will have the same behavior and will work for either integral types or floating point types. Example 2 below demonstrates how quotes can be used to specify literals in the format_specifier.

Remarks

In the case where the column fieldname specified by the column_fieldname parameter does not exist, "#InvalidStatFieldName#" will be displayed rather than the statistical result, where "InvalidStatFieldName" represents the string passed to the column_fieldname parameter.

The TextFormat property allows for a summary to be displayed across the entire SummaryRow. If the TextFormat property of a SummaryRow is set and one or more cell's also have a string assigned to their TitleFormat properties, there is a chance that the SummaryRow's text and the SummaryCells' titles will overlap. It is also possible to experience this behavior anytime a SummaryCell's StatFunction property is different than StatFunction.None.

If the FormatProvider property has not been explicitly set, the format provider of the column whose values are used to calculate the statistical function (StatFieldName) will be used.

To retrieve the resolved text displayed by the SummaryRow, the Text property can be consulted.

To support custom variables, the GetVariableText method must be overridden.

If a % is required in the text, for example to display a percentage, then %% must be used.

Example

Example 1 demonstrates how to set the TitleFormat property using statistical function variables.

Example 2 results in "val: 9.00" without the quotes, for the value "9". The internal quotes are necessary when the format_specifier contains a label (i.e., "val: ").

Example 1
summaryRow.TextFormat = "A minimum of MIN units were ordered at an average price of AVG."
summaryRow.TextFormat = "A minimum of MIN units were ordered at an average price of AVG.";
Example 2
summaryRow.TextFormat = "MIN:Quantity format=""val"
summaryRow.TextFormat = "MIN:Quantity format=\"\"val";
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SummaryRow Class
SummaryRow Members