下面的示例演示了如何计算绑定到“Size(Bytes)”字段的列的合计。 通过 TreeListColumn.SummaryFooter 和 TreeListColumn.SummaryFooterStrFormat 属性设置函数类型和汇总值的格式。
TreeListColumn.AllNodesSummary 属性值被设置为 true,以计算控件中所有节点的汇总。 启用了 TreeListOptionsView.ShowSummaryFooter 选项来显示汇总脚注。
C# | 复制代码 |
---|---|
using DevExpress.XtraTreeList; using DevExpress.XtraTreeList.Columns; // ... treeList1.OptionsView.ShowSummaryFooter = true; TreeListColumn column = treeList1.Columns["Size(Bytes)"]; column.AllNodesSummary = true; column.SummaryFooterStrFormat = "Total Sum {0:n0}"; column.SummaryFooter = SummaryItemType.Sum; |
Visual Basic | 复制代码 |
---|---|
Imports DevExpress.XtraTreeList Imports DevExpress.XtraTreeList.Columns ' ... TreeList1.OptionsView.ShowSummaryFooter = True Dim Column As TreeListColumn = TreeList1.Columns("Size(Bytes)") Column.AllNodesSummary = True Column.SummaryFooterStrFormat = "Total Sum {0:n0}" Column.SummaryFooter = SummaryItemType.Sum |