wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridcontrol-538c0894.md
Gets or sets the location of row totals. This is a dependency property.
Namespace : DevExpress.Xpf.PivotGrid
Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PivotGrid
public FieldRowTotalsLocation RowTotalsLocation { get; set; }
Public Property RowTotalsLocation As FieldRowTotalsLocation
| Type | Description |
|---|---|
| FieldRowTotalsLocation |
A FieldRowTotalsLocation enumeration value that specifies the location of row totals.
|
Available values:
| Name | Description |
|---|---|
| Near |
Row Totals are displayed above the row field values.
| | Far |
Row Totals are displayed under the row field values.
| | Tree |
The row field values are organized into a tree, and the row total is displayed as a root node of the tree.
|
Note that if the RowTotalsLocation property is set to FieldRowTotalsLocation.Tree, the PivotGridControl.ShowRowTotals and PivotGridControl.ShowTotalsForSingleValues properties can’t be set to False , and must remain True.
There are some limitations when the RowTotalsLocation property is set to FieldRowTotalsLocation.Tree:
The following example demonstrates how to add custom totals for a particular pivot grid field.
In this example, four different totals are added for the Category Name row field: Average, Sum, Min and Max. For this, they should be added to the PivotGridField.CustomTotals property and the PivotGridField.TotalsVisibility property should be set to FieldTotalsVisibility.CustomTotals.
<Window x:Class="HowToBindToMDB.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<dxpg:PivotGridControl HorizontalAlignment="Left" Name="pivotGridControl1"
VerticalAlignment="Top" RowTotalsLocation="Far">
<dxpg:PivotGridControl.Fields>
<dxpg:PivotGridField Name="fieldCategoryName" FieldName="CategoryName"
Area="RowArea" Caption="Category"
TotalsVisibility="CustomTotals">
<dxpg:PivotGridField.CustomTotals>
<dxpg:PivotGridCustomTotal SummaryType="Average" />
<dxpg:PivotGridCustomTotal SummaryType="Sum" />
<dxpg:PivotGridCustomTotal SummaryType="Max" />
<dxpg:PivotGridCustomTotal SummaryType="Min" />
</dxpg:PivotGridField.CustomTotals>
</dxpg:PivotGridField>
<dxpg:PivotGridField Name="fieldProductName" FieldName="ProductName" Area="RowArea"
Caption="Product Name" />
<dxpg:PivotGridField Name="fieldOrderYear" FieldName="OrderDate" Area="ColumnArea"
Caption="Order Year" GroupInterval="DateYear" />
<dxpg:PivotGridField Name="fieldExtendedPrice" FieldName="Extended Price"
Area="DataArea" CellFormat="c0" />
</dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>
</Grid>
</Window>
using System.Data;
using System.Data.OleDb;
using System.Windows;
using DevExpress.Xpf.PivotGrid;
using HowToBindToMDB.NwindDataSetTableAdapters;
using System;
namespace HowToBindToMDB {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
NwindDataSet.SalesPersonDataTable salesPersonDataTable = new NwindDataSet.SalesPersonDataTable();
SalesPersonTableAdapter salesPersonDataAdapter = new SalesPersonTableAdapter();
public MainWindow() {
InitializeComponent();
pivotGridControl1.DataSource = salesPersonDataTable;
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
salesPersonDataAdapter.Fill(salesPersonDataTable);
object[] filter = new object[15];
Array.Copy(fieldProductName.GetUniqueValues(), filter, filter.Length);
fieldProductName.FilterValues.ValuesIncluded = filter;
}
}
}
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows
Imports DevExpress.Xpf.PivotGrid
Imports HowToBindToMDB.NwindDataSetTableAdapters
Imports System
Namespace HowToBindToMDB
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits Window
Private salesPersonDataTable As New NwindDataSet.SalesPersonDataTable()
Private salesPersonDataAdapter As New SalesPersonTableAdapter()
Public Sub New()
InitializeComponent()
pivotGridControl1.DataSource = salesPersonDataTable
End Sub
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
salesPersonDataAdapter.Fill(salesPersonDataTable)
Dim filter(14) As Object
Array.Copy(fieldProductName.GetUniqueValues(), filter, filter.Length)
fieldProductName.FilterValues.ValuesIncluded = filter
End Sub
End Class
End Namespace
The following code snippets (auto-collected from DevExpress Examples) contain references to the RowTotalsLocation property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
wpf-pivot-grid-hide-specific-columns-and-row/CS/WpfApp/Data.cs#L31
}
pivot.RowTotalsLocation = FieldRowTotalsLocation.Near;
pivot.ShowRowGrandTotals = false;
wpf-pivot-grid-split-field-value-cells/CS/Data.cs#L30
}
pivot.RowTotalsLocation = FieldRowTotalsLocation.Far;
pivot.ColumnTotalsLocation = FieldColumnTotalsLocation.Far;
wpf-pivot-grid-hide-specific-columns-and-row/VB/WpfApp/Data.vb#L34
Next field
pivot.RowTotalsLocation = FieldRowTotalsLocation.Near
pivot.ShowRowGrandTotals = False
wpf-pivot-grid-split-field-value-cells/VB/Data.vb#L43
pivot.RowTotalsLocation = FieldRowTotalsLocation.Far
pivot.ColumnTotalsLocation = FieldColumnTotalsLocation.Far
See Also