This question is locked. New answers and comments are not allowed.
I have a Silverlight page with two RadGridView controls. The 'parent' grid is SampleGrid and the 'detail' grid is DetailGrid.
We are trying to provide the ability to use the keyboard to move the selected item in the parent grid while the detail grid is focused. In other words, while someone is editing the DetailGrid, if they press 'PageDown' or something then the SampleGrid will move to the next row.
I am using a custom KeyboardCommandProvide to try and make this happen. The first press of PageDown does cause the SampleGrid to move to the next row, however, the DetailGrid looses focus and pressing PageDown a second time does nothing. Clicking on the DetailGrid to give it focus then allows one more press of the PageDown functionality.
How do I keep the focus on the DetailGrid?
Here is the code to the custom keyboard provider:
I tried a few variations but none worked.
We are trying to provide the ability to use the keyboard to move the selected item in the parent grid while the detail grid is focused. In other words, while someone is editing the DetailGrid, if they press 'PageDown' or something then the SampleGrid will move to the next row.
I am using a custom KeyboardCommandProvide to try and make this happen. The first press of PageDown does cause the SampleGrid to move to the next row, however, the DetailGrid looses focus and pressing PageDown a second time does nothing. Clicking on the DetailGrid to give it focus then allows one more press of the PageDown functionality.
How do I keep the focus on the DetailGrid?
Here is the code to the custom keyboard provider:
I tried a few variations but none worked.
private
class
KeyboardBehavior : DefaultKeyboardCommandProvider
{
public
KeyboardBehavior(GridViewDataControl grid, GridViewDataControl parentGrid)
:
base
(grid)
{
Grid = grid;
ParentGrid = parentGrid;
}
private
GridViewDataControl Grid {
get
;
set
; }
private
GridViewDataControl ParentGrid {
get
;
set
; }
public
override
IEnumerable<ICommand> ProvideCommandsForKey(Key key)
{
if
(key == Key.PageDown)
{
ParentGrid.Items.MoveCurrentToNext();
Grid.Items.MoveCurrentToFirst();
Grid.Focus();
}
if
(key == Key.Enter)
{
return
new
List<ICommand>
{
RadGridViewCommands.CommitEdit
};
}
return
base
.ProvideCommandsForKey(key);
}
}