Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
    [Expand]Nodes
    [Expand]Data Editing
    [Expand]Data Representation
    [Expand]Sorting
    [Expand]Filtering
    [Collapse]Summaries
      Summary Types
      Total Summaries
      Group Summaries
      Custom Summaries
      Formatting Summary Values
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
    [Expand]Miscellaneous
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Formatting Summary Values

This topic describes the basics of formatting summaries. It describes the ways in which you can format a summary's text and change the appearance of a summary's values.

 

Expanded Formatting Summary Text

Total summary and group summary values are formatted according to the TreeListColumn.SummaryFooterStrFormat and TreeListColumn.RowFooterSummaryStrFormat properties, respectively. These properties define formats for summary values, which can be specified using the following structure:

<custom text>{0:<format specifier><precision specifier>}<custom text>

The following image shows how to assign custom formatting to group and total summary values via the Tree List Designer.

You can use the following code for the same purpose.

The image below shows the result.

Let's consider one more example of formatting the summary display text. The code below applies a summary to the Last Order column and formats the resulting date-time value. It sets the TreeListColumn.SummaryFooterStrFormat property to a Maximum month: {0:MMMM yyyy} string. So, the corresponding footer cell will display the name of the month and year in four-digit format.

The result is shown in the image below.

Expanded Changing the Appearance of Summary Values

In addition to applying custom formats to summary values, the Tree List control gives you the ability to change the appearance of footer cells with respect to the values they display. For instance, you can display values in different ranges using various colors. This can be done by handling the TreeList.CustomDrawFooterCell and TreeList.CustomDrawRowFooterCell events. These events enable you to custom paint cells depending upon the values they display. (Please refer to the Custom Drawing topic, for details.)

The following sample code applies conditional formatting to the row footer cells in the Budget column. Cells that display values greater than 1,000,000, and cells that display values less than this number are formatted in different ways. The TreeList.CustomDrawRowFooterCell event is handled to perform the task.

Note: the TreeListColumn.RowFooterSummaryStrFormat property of the Budget column must be set to {0}. Otherwise the sample code will not function properly.

The image below shows the result.

How would you rate this topic?​​​​​​​