We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Stop GridControl from Handling Undo Command

In our application, we implement an undo function via thecommand "System.Windows.Input.ApplicationCommands.Undo". We are assuming that the Syncfusion GridControl uses the same command to undo actions that are grid-related.
We would like to handle the undo command on a high level. Unfortunately, the Syncfusion GridControl is "stealing"/handling the command too early so that a click on our undo button does not have any effect (not even in the grid, I disabled the command stack of the GridControl.Model with

GridControl.Model.CommandStack.Enabled = false).

Is our assumption true, that Syncfusion's GridControl handles the ApplicationCommands.Undo command? I found no CommandBinding to this command, though. So where does the handling happen?
Is there a way to prevent the GridControl from messing with the undo command altogether, instead of just disabling the command stack?

4 Replies

KB Kanimozhi Bharathi Syncfusion Team July 5, 2016 12:42 PM UTC

  
Hi Marco Studer, 
 
We have checked your issue and you can overcome this issue by removing the Undo Command registered by the CommandManager internally in the GridControl. Since GridControl also uses the “ApplicationCommands.Undo” which internally handles the undo operation if the CommandStack is not enabled. Please find the code example for your reference, 
 
 
grid.CommandBindings.Remove(new CommandBinding(ApplicationCommands.Undo)); 
 
 
 
Regards 
Kanimozhi B 



KB Kanimozhi Bharathi Syncfusion Team July 5, 2016 05:09 PM UTC

Hi Marco Studer,  
 
Please ignore the previous update. 
  
We have checked your issue and you can overcome this issue by overriding the GridControl class and invoke the  OnCanExecuteUndo method. Since the ApplicationCommands.Undo is  registered by the CommandManager internally in the GridControl and it handles the undo operation in OnCanExecuteUndo method, if the CommandStack is not enabled. We have also prepared the sample for your reference. Please find the link below 
 
 
Regards  
Kanimozhi B  



MS Marco Studer July 8, 2016 12:27 PM UTC

Thanks a lot! It works.


KB Kanimozhi Bharathi Syncfusion Team July 12, 2016 04:09 AM UTC

Hi Marco Studer, 
Thank you for your update. 
Regards 
Kanimozhi B 


Loader.
Up arrow icon