The selection mode should be as in Windows Explorer - when Control is pressed, one should be able to move the current row with the up/down arrow keys and when Space is pressed, the current row should be selected/deselected.
This implementation can be used for the time being:
public partial class Form1 : RadForm
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
AddGridSimpleUnbound();
radGridView1.MultiSelect = true;
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new MyRowBehavior());
radGridView1.GridViewElement.Navigator = new MyNavigator();
}
class MyNavigator : BaseGridNavigator
{
protected override bool DoMultiSelect(GridViewRowInfo oldRow, GridViewColumn oldColumn, GridViewRowInfo row, GridViewColumn column)
{
if (!this.IsShiftButtonPressed && this.IsControlButtonPressed && !this.IsMouseSelection)
{
return true;
}
return base.DoMultiSelect(oldRow, oldColumn, row, column);
}
}
class MyRowBehavior : GridDataRowBehavior
{
bool kbdSelection = false;
public override bool ProcessKeyPress(KeyPressEventArgs keys)
{
if (kbdSelection)
{
kbdSelection = false;
return true;
}
return base.ProcessKeyPress(keys);
}
public override bool ProcessKey(KeyEventArgs keys)
{
if (keys.KeyCode == Keys.Space && this.GridControl.MultiSelect && keys.Control)
{
this.GridControl.CurrentRow.IsSelected ^= true;
kbdSelection = true;
return false;
}
else
{
return base.ProcessKey(keys);
}
}
}
}