Per this post (http://www.telerik.com/community/forums/wpf/gridview/edit-mode-and-the-keyboardcommandprovider.aspx) it was recommended that I implement key handling for navigation by handling PreviewKeyDown. This was working fine up until the latest version of the GridView control, in my case, Q1 2011. If I press the down arrow while in a text box in edit mode, it should move down, select the next box and then go into edit mode. Now, the cursor does move down but the cell does not enter edit mode. This is the code that's been working for some time:
private void HandleKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Down)
{
RadGridViewCommands.MoveDown.Execute(null);
RadGridViewCommands.SelectCurrentUnit.Execute(null);
RadGridViewCommands.BeginEdit.Execute(null);
e.Handled = true;
}
}
5 Answers, 1 is accepted
0
Hi Dave Kehring,
Maya
the Telerik team
We have improved the implementation of our commands so they can be executed asynchronous. That is why you encountered such a difference. I am sending you the updated project that works with our current official release.
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

alvin
Top achievements
Rank 1
answered on 28 Jul 2011, 03:40 PM
Hi, is there any particular reason that the in the HandleKeyRight the command is executed in Dispatcher, but not in HandleKeyLeft?
Thanks.
Thanks.
0
Hi Alvin,
Maya
the Telerik team
Generally, this is just illustrating a possible solution that might be useful depending on the editing element. Still, you may implement the code as it is in the HandleKeyLeft(e) method - without invoking a dispatcher.
Maya
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0

Arnstein
Top achievements
Rank 1
answered on 29 Jan 2014, 03:01 PM
Hi,
this solution works fine if you're dealing with textboxes in the grid. I'm having some issues with RadDatePicker and RadComboBox.
RadDatePicker; tried to cast CurrentCell to RadDatePicker in the CurrentCell_GotFocus method, but RadDatePicker doesn't have a SelectAll() method and I end up with a StackOwerflowException if try to call Focus().
The issue with RadComboBox is perhaps a bit more tricky to deal with. If you open the ComboBox and try to select a value with arrow up or down you'll end up switching cell.
Is there an easier way to deal with these issues than treating each control with special care? When it comes to the RadDatePicker I'd like the same behavior as you get with the enter key. The combobox should handle arrow up and down when in "dropdown" mode, and stopping the event from bubbling up. I would really appreciate some assistance on these two issues.
Telerik version 2013.3 Sp1
Best regards
Arnstein
this solution works fine if you're dealing with textboxes in the grid. I'm having some issues with RadDatePicker and RadComboBox.
RadDatePicker; tried to cast CurrentCell to RadDatePicker in the CurrentCell_GotFocus method, but RadDatePicker doesn't have a SelectAll() method and I end up with a StackOwerflowException if try to call Focus().
The issue with RadComboBox is perhaps a bit more tricky to deal with. If you open the ComboBox and try to select a value with arrow up or down you'll end up switching cell.
Is there an easier way to deal with these issues than treating each control with special care? When it comes to the RadDatePicker I'd like the same behavior as you get with the enter key. The combobox should handle arrow up and down when in "dropdown" mode, and stopping the event from bubbling up. I would really appreciate some assistance on these two issues.
Telerik version 2013.3 Sp1
Best regards
Arnstein
0
Hello Dave,
In order to be able to select the date, you should firstly get the element as RadDatePicker, and get the RadDatePicker's TextBox, on which you can set the focus.
You can use the following snippet as an example:
The problem with RadComboBox is that the
The following snippet can be used as an example:
Regards,
Hristo
Telerik
In order to be able to select the date, you should firstly get the element as RadDatePicker, and get the RadDatePicker's TextBox, on which you can set the focus.
You can use the following snippet as an example:
var datePicker = edititngElement
as
RadDatePicker;
if
(datePicker !=
null
)
{
var textbox = datePicker.ChildrenOfType<TextBox>().FirstOrDefault();
if
(textbox !=
null
)
{
textbox.SelectAll();
textbox.Focus();
}
}
The problem with RadComboBox is that the
Ha
ndleKey... methods are executed instead of the default key commands. You can solve this issue by executing this methods only when the selected method is not of type RadComboBox.The following snippet can be used as an example:
var editBox =
this
.clubsGrid.CurrentCell.GetEditingElement();
if
(editBox
as
RadComboBox ==
null
)
{
this
.HandleKeyDown(e);
this
.HandleKeyUp(e);
this
.HandleKeyLeft(e);
this
.HandleKeyRight(e);
}
Regards,
Hristo
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>