PivotGridControl.ExpandAllRowsAsync() Method
Expands all rows asynchronously.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
Declaration
Returns
Type | Description |
---|---|
Task<Boolean> | An asynchronous operation that returns |
Remarks
The ExpandAllRowsAsync
method is asynchronous. ExpandAllRowsAsync
starts to execute the related operation in a background thread, and returns the Pivot Grid control. The main UI thread remains unblocked to allow the application to continue responding to user actions. Refer to the following topic for more information: Asynchronous Mode.
Use the following methods to collapse or expand Pivot Grid rows:
- CollapseAllRowsAsync
- Collapses all rows asynchronously.
- ExpandAllRows()
- Expands all rows.
- CollapseAllRows
- Collapses all rows.
Use the following methods to collapse or expand Pivot Grid columns:
- ExpandAllColumnsAsync
- Expands all columns asynchronously.
- ExpandAllColumns
- Expands all columns.
- CollapseAllColumns
- Collapses all columns.
- CollapseAllColumnsAsync
- Collapses all columns asynchronously.
You can specify whether a user can expand or collapse field values in the UI. For this, use the PivotGridFieldOptions.AllowExpand property.
Example
The following example shows how to expand all rows in the Pivot Grid asynchronously. The image below displays the resulting Pivot Grid with expanded rows for the Country and City fields.
using DevExpress.XtraPivotGrid;
using System.Windows.Forms;
namespace WindowsFormsApp2 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
pivotGridControl1.OptionsBehavior.UseAsyncMode = true;
ConfigureLayout();
}
async void ConfigureLayout() {
pivotGridControl1.BeginUpdate();
// Create and configure Pivot Grid fields
PivotGridField fieldCountry = pivotGridControl1.Fields.Add("Country", PivotArea.RowArea);
fieldCountry.DataBinding = new DataSourceColumnBinding("[Customer].[Country].[Country]");
fieldCountry.Name = "fieldCountry";
PivotGridField fieldCity = pivotGridControl1.Fields.Add("City", PivotArea.RowArea);
fieldCity.DataBinding = new DataSourceColumnBinding("[Customer].[City].[City]");
fieldCity.Name = "fieldCity";
// ...
await pivotGridControl1.EndUpdateAsync();
await pivotGridControl1.ExpandAllRowsAsync();
}
}
}