5 Answers, 1 is accepted
0
Hi,
Vlad
the Telerik team
Indeed this is possible if you enable cell selection. You can check this demo for more info.
Regards,Vlad
the Telerik team
0
Mike
Top achievements
Rank 1
answered on 22 Feb 2011, 01:01 AM
Thanks - it works by setting the SelectionUnit to single. But now this breaks something else. Up until now, I have been letting the user delete a whole row by highlighting it and hitting the Delete key. Obviously, this doesn't work any more. Is there any way to have whole row selection for deleting, and also single cell selection for copying?
0
Hi Mike,
There are several way to have the functionality. Here is one of them:
public MainPage() { InitializeComponent(); this.AddHandler(FrameworkElement.KeyDownEvent, new KeyEventHandler(playersGrid_KeyDown), true); } void playersGrid_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { var selectedCell = this.playersGrid.SelectedCells.FirstOrDefault(); if (selectedCell != null) { var deleteCommand = RadGridViewCommands.Delete as RoutedCommand; deleteCommand.Execute(selectedCell.Item, this.playersGrid); } }Hope this helps.
Greetings,
Milan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Mike
Top achievements
Rank 1
answered on 01 Mar 2011, 02:56 AM
Thanks for the reply, but unfortunately this doesn't work.
If I set a breakpoint on the first line of the KeyDown handler then I see it being hit for all keys EXCEPT for when I press the Delete key (and, incidentally, the Insert key too). I assume this is because the grid already handles those keys further up the chain. Any other ideas?
If I set a breakpoint on the first line of the KeyDown handler then I see it being hit for all keys EXCEPT for when I press the Delete key (and, incidentally, the Insert key too). I assume this is because the grid already handles those keys further up the chain. Any other ideas?
0
Hello Mike,
When you subscribe to an event with AddHandler with its last argument equal to true, you will be able to handle any event event if it has been marked as handled.
Kind regards,
Milan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
