Infragistics(R) NetAdvantage(R) for WPF
Apply Default Summary Formats


Glossary Item Box

You can format a summary value by setting the StringFormat property of a SummaryDefinition object in a field layout's SummaryDefinitions collection; however, xamDataGrid™ offers an alternative way to format summary values using very little code. You can set the SummaryStringFormats property of a Field object to apply default formatting for summaries in that field.

You can set the SummaryStringFormats property to a comma-delimited list of formats for the different calculators. Each token in the comma-delimited string must start with the name of a summary calculator, followed by a colon, and then a composite format string. For example, if you want to format the value of the sum and average calculator, you can set the Field object's SummaryStringFormats property to "sum:Total Revenue = {0:c}, average: Mean Revenue = {0:c}". In addition to the ('0') placeholder, you can also use the following placeholders in your composite format string:

The following example code demonstrates how to apply default summary formats. The example code assumes you have a field named "revenue" in your field layout.

In XAML:

...
<igDP:Field 
    Name="revenue" 
    Label="Revenue" 
    SummaryStringFormats="{}sum:Revenue = {0:c}, average:Mean Revenue = {0:c}" />
...

In Visual Basic:

...
Me.xamDataGrid1.FieldLayouts(0).Fields("revenue").SummaryStringFormats = "sum:Revenue = {0:c}, average: Mean Revenue = {0:c}"
...

In C#:

...
this.xamDataGrid1.FieldLayouts[0].Fields["revenue"].SummaryStringFormats = "sum:Revenue = {0:c}, average: Mean Revenue = {0:c}";
...
Related Topics

Creating a Custom Summary Calculator

Enable Row Summaries

Format the Value of a Summary

Programmatically Add Summaries to a Field

Retrieve the Result of a Summary