Hello Telerik Team,
I'would like to override de default GridView DeleteCommand. I'm working with MVVM and my ViewModel object already offers a DelegateCommand to remove items from GridView. I've added a column with Delete button bound to this command to allow users remove items. I'd also like users being able to remove items via Del key, so I'm supplying a custom KeyboardCommandProvider like this:
The custom command provider works fine. The matter is that when Command execute method is invoked, the argument parameter is null. I expect the parameter being the a row item or a row items collection.
Is there any way to get the items to delete when pressing "Del" key?
I'would like to override de default GridView DeleteCommand. I'm working with MVVM and my ViewModel object already offers a DelegateCommand to remove items from GridView. I've added a column with Delete button bound to this command to allow users remove items. I'd also like users being able to remove items via Del key, so I'm supplying a custom KeyboardCommandProvider like this:
public
class
RadGridViewCustomDeleteKeyProvider : DefaultKeyboardCommandProvider
{
public
RadGridViewCustomDeleteKeyProvider(GridViewDataControl dataControl)
:
base
(dataControl)
{
}
public
ICommand DeleteCommand {
get
;
set
; }
public
override
IEnumerable<ICommand> ProvideCommandsForKey(Key key)
{
var commands =
base
.ProvideCommandsForKey(key).ToList();
if
(commands.Contains(RadGridViewCommands.Delete))
{
commands.Remove(RadGridViewCommands.Delete);
commands.Add(DeleteCommand);
}
return
commands;
}
}
The custom command provider works fine. The matter is that when Command execute method is invoked, the argument parameter is null. I expect the parameter being the a row item or a row items collection.
Is there any way to get the items to delete when pressing "Del" key?