Hi,
I am having the following issue with my Custom KeyboadCommandProvider for RadGridView: If the user presses Ctrl+Down key, i want to select the third column of the next row. Therefore i move down once, check if Ctrl is pressed and if so, move to the first column and then twice to the Right. The problem is, that the Move-Commands also factor in the pressed shift key. Therefore the selection moves to the bottom of the list, then to the right and then twice to the end of the row. My code looks as follows:
public class ScheduleKeyboardCommandProvider : DefaultKeyboardCommandProvider
{
private GridViewDataControl parentGrid;
public ScheduleKeyboardCommandProvider(GridViewDataControl grid)
: base(grid)
{
this.parentGrid = grid;
}
public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
{
List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
commandsToExecute.Clear();
bool ctrlIsPressed = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
if (key == Key.Down)
{
commandsToExecute.Add(RadGridViewCommands.MoveDown);
if (ctrlIsPressed)
{
// move to first column and then move right twice
commandsToExecute.Add(RadGridViewCommands.MoveFirst);
commandsToExecute.Add(RadGridViewCommands.MoveRight);
commandsToExecute.Add(RadGridViewCommands.MoveRight);
}
}
return commandsToExecute;
}
}
I would appreciate some tips. Thanks in advance.