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.
Unfortunately, activation email could not send to your email. Please try again.

Stop GridControl from Handling Undo Command

Thread ID:

Created:

Updated:

Platform:

Replies:

124846 Jul 4,2016 07:24 AM Jul 12,2016 12:09 AM WPF 4
loading
Tags: GridControl
Marco Studer
Asked On July 4, 2016 07:24 AM

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 08:42 AM

  
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 


Kanimozhi Bharathi [Syncfusion]
Replied On July 5, 2016 01:09 PM

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  


Marco Studer
Replied On July 8, 2016 08:27 AM

Thanks a lot! It works.

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

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


CONFIRMATION

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.

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.

;