Skip to main content
A newer version of this page is available. .

How to: Display Totals

  • 7 minutes to read

This example shows how to display totals. It is shown how to create summary items in code-behind and XAML.

View Example

<Window x:Class="DXTreeList_Totals.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid">
    <Grid>
        <dxg:TreeListControl Name="treeListControl1" AutoPopulateColumns="True">
            <dxg:TreeListControl.View>
                <dxg:TreeListView Name="treeListView1" AutoWidth="True"
                                  KeyFieldName="ID" ParentFieldName="ParentID"
                                  ShowTotalSummary="True"/>
            </dxg:TreeListControl.View>
            <dxg:TreeListControl.TotalSummary>
                <dxg:TreeListSummaryItem FieldName="Name" SummaryType="Count" />
            </dxg:TreeListControl.TotalSummary>
        </dxg:TreeListControl>
    </Grid>
</Window>