Hi,
I use the delete shortcut key to perform a delete operation based on the selected record in a datagrid. The shortcut is defined as:
<igRibbon:XamRibbonWindow.InputBindings> <KeyBinding Key="Delete" Command="{x:Static infra:Commands.CommandProxy.DeleteCommand}"/>...
When I edit a cell (a string) in the datagrid, I want the default delete behaviour, i.e. deleting the selected characters within the cell
However, the above xaml captures the delete key without passing to the cell
How may I control the delete key's coverage scope, i.e. invoke the delete command if the row is selected, and perform deleting the characters with a cell's value is highlighted
Thanks
Thomas
Hello,
I just wanted to know if you was able to solve key Bindings’s issue based on Peter’s suggestions or you still need help? Just let me know. Thank you.
Sincerely,DimiDeveloper Support Engineer,MCPD
Hi Thomas,
If you have added this CommandBinding to your Ribbon/RibbonwWindow you should have no trouble.
Please double check if you have not missed that out.
Regards Petar.
Thanks. I don't see the CanExecuteRoutedEventHandler handler is triggered. Am I missing something? Thanks
CommandBinding
();
DeleteStrategyCommand =
>(DeleteStrategy, CanDeleteStrategy);
.DeleteStrategyCommand.RegisterCommand(DeleteStrategyCommand);
cb.Command = DeleteStrategyCommand;
cb.CanExecute +=
(cb_CanExecute);
cb.PreviewCanExecute +=
(cb_PreviewCanExecute);
Hello Thomas,
You can check out this link on Commanding to see how to set the ConntinueRouting property: http://help.infragistics.com/NetAdvantage/WPF/2010.2/CLR4.0/?page=InfragisticsWPF4.Ribbon.v10.2~Infragistics.Windows.Ribbon.XamRibbon~ExecutingCommand_EV.html
I still want to point out that the behaviour you describe is the default one and I you can probably find a more suitable Command in your scenario.
Hope this helps.
Hi Petar,
Thanks for your help. I have the following in my Shell.xaml (application scope)
<KeyBinding Key="Delete" Command="{x:Static infra:Commands.CommandProxy.DeleteRowsCommand}"/>
This DeleteRowsCommand will find the selected rows in the grid and delete them
This works well except:
When I edit a cell (in edit mode), I highlight the cell's value, then press the delete key. I suppose pressing the delete key will clear the cell's value. But this action is captured by the KeyBinding defined in the Shell.xaml. As a result, the DeleteRowsCommand is triggered!