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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Stop GridControl from Handling Undo Command

Thread ID:





124846 Jul 4,2016 11:24 AM UTC Jul 12,2016 04:09 AM UTC WPF 4
Tags: GridControl
Marco Studer
Asked On July 4, 2016 11:24 AM UTC

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?

Kanimozhi Bharathi [Syncfusion]
Replied On 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)); 
Kanimozhi B 

Kanimozhi Bharathi [Syncfusion]
Replied On 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 
Kanimozhi B  

Marco Studer
Replied On July 8, 2016 12:27 PM UTC

Thanks a lot! It works.

Kanimozhi Bharathi [Syncfusion]
Replied On July 12, 2016 04:09 AM UTC

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon