Completed
Last Updated: 11 Jun 2018 12:35 by Dimitar
ADMIN
Hristo
Created on: 26 Mar 2018 06:58
Category: Spreadsheet
Type: Bug Report
0
FIX. RadSpreadSheet - navigation with the arrow keys when holding the Shift button should extend the current selection
Workaround: create a custom input behavior class and manually handle the navigation when holding the Shift key
public partial class SpreadsheetForm : Telerik.WinControls.UI.RadForm
{
    public SpreadsheetForm()
    {
        InitializeComponent();

        FieldInfo behaviorFi = typeof(RadSpreadsheetElement).GetField("inputHandler", BindingFlags.Instance | BindingFlags.NonPublic);
        behaviorFi.SetValue(this.radSpreadsheet1.SpreadsheetElement, new CustomSpreadsheetInputBehavior(this.radSpreadsheet1.SpreadsheetElement));
    }
}

public class CustomSpreadsheetInputBehavior : SpreadsheetInputBehavior
{
    public CustomSpreadsheetInputBehavior(RadSpreadsheetElement element)
    : base(element) { }

    public override void ProcessKeyDown(KeyEventArgs e)
    {
        base.ProcessKeyDown(e);

        if (e.Shift)
        {
            switch (e.KeyCode)
            {
                case Keys.Left:
                    this.Spreadsheet.ActiveWorksheetEditor.Commands.UpdateActiveSelectionRangeCommand.Execute(MovementType.MoveToPreviousColumn);
                    break;
                case Keys.Up:
                    this.Spreadsheet.ActiveWorksheetEditor.Commands.UpdateActiveSelectionRangeCommand.Execute(MovementType.MoveToPreviousRow);
                    break;
                case Keys.Right:
                    this.Spreadsheet.ActiveWorksheetEditor.Commands.UpdateActiveSelectionRangeCommand.Execute(MovementType.MoveToNextColumn);
                    break;
                case Keys.Down:
                    this.Spreadsheet.ActiveWorksheetEditor.Commands.UpdateActiveSelectionRangeCommand.Execute(MovementType.MoveToNextRow);
                    break;
            }
        }
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments