Back to Devexpress

PivotGridControl.CollapseAllAsync() Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-aa1a65e4.md

latest4.4 KB
Original Source

PivotGridControl.CollapseAllAsync() Method

Collapses all columns and rows in a Pivot Grid control asynchronously.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public Task<bool> CollapseAllAsync()
vb
Public Function CollapseAllAsync As Task(Of Boolean)

Returns

TypeDescription
Task<Boolean>

An asynchronous operation that returns true in case of success.

|

Remarks

The CollapseAllAsync method is asynchronous. CollapseAllAsync 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.

To expand all columns and rows asynchronously, use the PivotGridControl.ExpandAllAsync method.

To collapse or expand all columns and rows synchronously, use the PivotGridControl.CollapseAll and PivotGridControl.ExpandAll methods, respectively.

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 code snippet collapses all Pivot Grid columns and rows asynchronously:

csharp
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() {
          await pivotGridControl1.CollapseAllAsync();
        }
    }
}
vb
Imports DevExpress.XtraPivotGrid
Imports System.Windows.Forms

Namespace WindowsFormsApp2
    Partial Public Class Form1
        Inherits Form

        Public Sub New()
            InitializeComponent()
            pivotGridControl1.OptionsBehavior.UseAsyncMode = True
            ConfigureLayout()
        End Sub
        Private Async Sub ConfigureLayout()
          Await pivotGridControl1.CollapseAllAsync()
        End Sub
    End Class
End Namespace

See Also

CollapseValue(Boolean, Object[])

CollapseValueAsync

ExpandValue(Boolean, Object[])

ExpandValueAsync

CollapseAllColumns()

CollapseAllColumnsAsync

CollapseAllRows()

CollapseAllRowsAsync

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace