Skip to main content

PivotGridControl.EndUpdate() Method

Unlocks the PivotGridControl object after a call to the BeginUpdate method and causes an immediate visual update.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v22.1.dll


public void EndUpdate()


See PivotGridControl.BeginUpdate to learn more.

To update PivotGridControl asynchronously, use the PivotGridControl.EndUpdateAsync method.


The following example demonstrates how to lock the pivot grid, thus preventing it from being redrawn while a sequence of operations that affect its appearance and/or functionality is being performed.In this example, the pivot grid is transposed by moving Row Fields to the Column Area, and vice versa. Prior to this, the BeginUpdate method is called to lock the pivot grid. When the transposition is completed, the pivot grid is unlocked via the EndUpdate method. To ensure that the EndUpdate method is always called even if an exception occurs, calls to the BeginUpdate and EndUpdate methods are wrapped in a try…finally statement.

View Example

Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Windows
Imports DevExpress.Xpf.PivotGrid

Namespace DXPivotGrid_BeginEndUpdate
    Partial Public Class MainWindow
        Inherits Window
        Public Sub New()
            pivotGridControl1.DataSource = GetDataTable()
        End Sub
        Private Sub btnRun_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim startTime As DateTime = DateTime.Now

            ' If an appropriate option is enabled, 
            ' locks the pivot grid to prevent further updates.
            If rbLocked.IsChecked = True Then
            End If

                ' Initiates transposition.

                ' If the pivot grid has been locked, unlocks it, allowing further updates.
                If rbLocked.IsChecked = True Then
                End If
            End Try

            ' Displays the amount of time taken by the transposition.
            Dim duration As TimeSpan = DateTime.Now.Subtract(startTime)
            MessageBox.Show("Transposition took " & duration.TotalSeconds.ToString("F2") & " seconds")
        End Sub

        ' Transposes the pivot grid by moving Row Fields to the Column Area, and vice versa.
        Private Sub Transpose()
            For Each field As PivotGridField In pivotGridControl1.Fields
                If field.Area = FieldArea.RowArea Then
                    field.Area = FieldArea.ColumnArea
                ElseIf field.Area = FieldArea.ColumnArea Then
                    field.Area = FieldArea.RowArea
                End If
            Next field
        End Sub

        ' Generates pivot grid data.
        Public Shared Function GetDataTable() As DataTable
            Dim table As New DataTable()
            table.Columns.Add("A", GetType(String))
            table.Columns.Add("B", GetType(String))
            table.Columns.Add("Data", GetType(Integer))
            For i As Integer = 0 To 999
                For j As Integer = 0 To 499
                    table.Rows.Add("A"c + i.ToString(), "B"c + j.ToString(), (CInt(Fix(i)) / 100))
                Next j
            Next i
            Return table
        End Function
    End Class
End Namespace
See Also