Search code examples
c#winformsinfragisticsundoultrawingrid

Undo Context Menu on UltraWinGrid


I am trying to put up an Undo context Menu on UltraWinGrid to undo the last change that was made to the grid The code looks like this

  private void _undoAll_Click(object sender, EventArgs e)
    {
        this.GridName.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.Undo); 

    }

But its not providing the desired result. I can not use DataTable UndoChanges feature because I am binding a custom class to this Grid


Solution

  • Make sure you set DisplayLayout.Override.AllowMultiCellOperation to include the flag that allows the Undo operation.

    In code you should set something like this in your Form_Load event:

    this.GridName.DisplayLayout.Override.AllowMultiCodeOperations = 
                  AllowMultiCellOperation.Undo | AllowMultiCellOperation.Redo;
    

    also I have found this thread on Infragistics site that explain better what going on here