windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-79048a75.md
Unlocks the Pivot Grid control after the PivotGridControl.BeginUpdate method call, and starts an asynchronous update.
Namespace : DevExpress.XtraPivotGrid
Assembly : DevExpress.XtraPivotGrid.v25.2.dll
NuGet Package : DevExpress.Win.PivotGrid
public Task<bool> EndUpdateAsync()
Public Function EndUpdateAsync As Task(Of Boolean)
| Type | Description |
|---|---|
| Task<Boolean> |
An asynchronous operation that returns true in case of success.
|
PivotGridControl allows you to execute a sequence of operations that affect the control’s appearance and/or functionality without rendering the Pivot Grid after each change. To do this, wrap the code in the PivotGridControl.BeginUpdate and EndUpdateAsync method calls to enable the control to update asynchronously in a background thread. This improves the Pivot Grid’s performance and avoids unnecessary rendering operations.
The EndUpdateAsync method is asynchronous. EndUpdateAsync 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 following example shows how to create Pivot Grid fields and populate them with data asynchronously:
using DevExpress.XtraPivotGrid;
using System.Windows.Forms;
namespace WindowsFormsApp2 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
pivotGridControl1.OLAPConnectionString = "Provider=msolap;" +
"Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" +
"Initial Catalog=Adventure Works DW Standard Edition;" +
"Cube Name=Adventure Works;";
pivotGridControl1.OptionsBehavior.UseAsyncMode = true;
ConfigureLayout();
}
async void ConfigureLayout() {
pivotGridControl1.BeginUpdate();
// Create and configure Pivot Grid fields
PivotGridField fieldCountry = pivotGridControl1.Fields.Add("Country", PivotArea.ColumnArea);
fieldCountry.DataBinding = new DataSourceColumnBinding("[Customer].[Country].[Country]");
fieldCountry.Name = "fieldCountry";
PivotGridField fieldDateFiscalYearFiscalYear = pivotGridControl1.Fields.Add("Fiscal Year", PivotArea.RowArea);
fieldDateFiscalYearFiscalYear.DataBinding = new DataSourceColumnBinding("[Date].[Fiscal Year].[Fiscal Year]");
fieldDateFiscalYearFiscalYear.Name = "fieldFiscalYear";
PivotGridField fieldMeasuresInternetSalesAmount = pivotGridControl1.Fields.Add("Internet Sales Amount", PivotArea.DataArea);
fieldMeasuresInternetSalesAmount.Area = PivotArea.DataArea;
fieldMeasuresInternetSalesAmount.DataBinding = new DataSourceColumnBinding("[Measures].[Internet Sales Amount]");
fieldMeasuresInternetSalesAmount.Name = "fieldSales";
await pivotGridControl1.EndUpdateAsync();
}
}
}
Imports DevExpress.XtraPivotGrid
Imports System.Windows.Forms
Namespace WindowsFormsApp2
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
pivotGridControl1.OLAPConnectionString = "Provider=msolap;" & "Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" & "Initial Catalog=Adventure Works DW Standard Edition;" & "Cube Name=Adventure Works;"
pivotGridControl1.OptionsBehavior.UseAsyncMode = True
ConfigureLayout()
End Sub
Private Async Sub ConfigureLayout()
pivotGridControl1.BeginUpdate()
' Create and configure Pivot Grid fields
Dim fieldCountry As PivotGridField = pivotGridControl1.Fields.Add("Country", PivotArea.ColumnArea)
fieldCountry.DataBinding = New DataSourceColumnBinding("[Customer].[Country].[Country]")
fieldCountry.Name = "fieldCountry"
Dim fieldDateFiscalYearFiscalYear As PivotGridField = pivotGridControl1.Fields.Add("Fiscal Year", PivotArea.RowArea)
fieldDateFiscalYearFiscalYear.DataBinding = New DataSourceColumnBinding("[Date].[Fiscal Year].[Fiscal Year]")
fieldDateFiscalYearFiscalYear.Name = "fieldFiscalYear"
Dim fieldMeasuresInternetSalesAmount As PivotGridField = pivotGridControl1.Fields.Add("Internet Sales Amount", PivotArea.DataArea)
fieldMeasuresInternetSalesAmount.Area = PivotArea.DataArea
fieldMeasuresInternetSalesAmount.DataBinding = New DataSourceColumnBinding("[Measures].[Internet Sales Amount]")
fieldMeasuresInternetSalesAmount.Name = "fieldSales"
Await pivotGridControl1.EndUpdateAsync()
End Sub
End Class
End Namespace
See Also