Xceed Grid for WinForms v4.3 Documentation
TitleFormat Property (SummaryCell)
Example 


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

<CategoryAttribute("Appearance")>

<LocalizableAttribute(True)>

<ApplyToDesignerAttribute(True)>

Public Property TitleFormat As String
'Usage
 
Dim instance As SummaryCell

Dim value As String

 

instance.TitleFormat = value

 

value = instance.TitleFormat
[Description("A string used to dynamically create the SummaryCell's Title.")]

[Category("Appearance")]

[Localizable(true)]

[ApplyToDesigner(true)]

public string TitleFormat {get; set;}

Property Value

A string used to dynamically create the SummaryCell's Title. By default, DefaultTitleFormat.

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.
%STATCOLUMNFIELDNAME% The Column.FieldName of the column as defined by the StatFieldName property.
%STATCOLUMNTITLE% The Column.Title of the column represented by the StatFieldName property.
%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: ["]stat_fieldname["] [ format=["]format_specifier["] ] [ level=running_stat_group_level ]%

All items placed in square brackets [] are optional. If the stat_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 TitleFormat 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 StatFieldName property.
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 StatFieldName property does not exist, "#InvalidStatFieldName#" will be displayed rather than the statistical result, where "InvalidStatFieldName" representings the string passed to the StatFieldName property.

The SummaryRow.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 SummaryRow.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.

The properties that affect the appearance of the title (BackColor, ForeColor, Font, etc.) will be retrieved from the Cell.ParentRow and not from the SummaryCell.

The position of the title can be modified by setting the TitlePosition property.

To retrieve the resolved text displayed by the SummaryCell, the Title 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
summaryCell.TitleFormat = "A minimum of %MIN:Quantity% units were ordered at an average price of %AVG:UnitPrice format=c%."
summaryCell.TitleFormat = "A minimum of %MIN:Quantity% units were ordered at an average price of %AVG:UnitPrice format=c%.";
Example 2
summaryCell.TitleFormat = "%MIN:Quantity format=""val: "0.00"%"
summaryCell.TitleFormat = "%MIN:Quantity format=\"\"val: \"0.00\"%";
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

SummaryCell Class
SummaryCell Members