Back to Devexpress

PivotGridControl.ExpandValueAsync(Boolean, Object[]) Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-expandvalueasync-x28-system-dot-boolean-system-dot-object-x29.md

latest4.6 KB
Original Source

PivotGridControl.ExpandValueAsync(Boolean, Object[]) Method

Expands the specified column or row asynchronously.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public Task<bool> ExpandValueAsync(
    bool isColumn,
    object[] values
)
vb
Public Function ExpandValueAsync(
    isColumn As Boolean,
    values As Object()
) As Task(Of Boolean)

Parameters

NameTypeDescription
isColumnBoolean

true to expand a column; false to expand a row.

| | values | Object[] |

An array of field values that identify the column/row to be expanded.

|

Returns

TypeDescription
Task<Boolean>

An asynchronous operation that returns true in case of success.

|

Remarks

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

The image below shows the Pivot Grid with the collapsed “Austria” column.

To expand the “Austria” column (within the “Alice Mutton” column), use the following code:

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.ExpandValueAsync(true, new object[] {"Alice Mutton", "Austria"});
        }
    }
}
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.ExpandValueAsync(True, New Object() {"Alice Mutton", "Austria"})
        End Sub
    End Class
End Namespace

The result of this operation is shown below:

Use the PivotGridControl.ExpandValue method to expand a column or row synchronously.

To collapse a column or row, use the PivotGridControl.CollapseValueAsync (asynchronous) or PivotGridControl.CollapseValue (synchronous) method.

See Also

ExpandValue(Boolean, Object[])

CollapseValue(Boolean, Object[])

CollapseValueAsync

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace