diff --git a/src/BlazorDatasheet/Datasheet.razor.cs b/src/BlazorDatasheet/Datasheet.razor.cs index 815731da..1e898ba2 100644 --- a/src/BlazorDatasheet/Datasheet.razor.cs +++ b/src/BlazorDatasheet/Datasheet.razor.cs @@ -220,7 +220,7 @@ private void HandleCellMouseUp(int row, int col, MouseEventArgs e) private void HandleCellMouseDown(int row, int col, MouseEventArgs e) { if (e.ShiftKey && Sheet?.Selection?.ActiveRegion != null) - Sheet?.Selection?.ActiveRegion.ExtendTo(row, col); + Sheet?.Selection?.ExtendTo(row, col); else { if (!e.MetaKey && !e.CtrlKey) @@ -242,7 +242,7 @@ private void HandleCellMouseDown(int row, int col, MouseEventArgs e) private void HandleColumnHeaderMouseDown(int col, MouseEventArgs e) { if (e.ShiftKey && Sheet?.Selection?.ActiveRegion != null) - Sheet?.Selection?.ActiveRegion.ExtendTo(0, col); + Sheet?.Selection?.ExtendTo(0, col); else { if (!e.MetaKey && !e.CtrlKey) @@ -259,7 +259,7 @@ private void HandleColumnHeaderMouseDown(int col, MouseEventArgs e) private void HandleRowHeaderMouseDown(int row, MouseEventArgs e) { if (e.ShiftKey && Sheet?.Selection?.ActiveRegion != null) - Sheet?.Selection?.ActiveRegion.ExtendTo(row, 0); + Sheet?.Selection?.ExtendTo(row, 0); else { if (!e.MetaKey && !e.CtrlKey) diff --git a/src/BlazorDatasheet/Selecting/Selection.cs b/src/BlazorDatasheet/Selecting/Selection.cs index 6ba192a3..5f1e558e 100644 --- a/src/BlazorDatasheet/Selecting/Selection.cs +++ b/src/BlazorDatasheet/Selecting/Selection.cs @@ -218,6 +218,17 @@ public void Remove(IRegion region) emitSelectionChange(); } + /// + /// Extends the active region to the row/col specified + /// + /// + /// + internal void ExtendTo(int row, int col) + { + ActiveRegion?.ExtendTo(row, col); + emitSelectingChanged(); + } + /// /// Clears any selections or active selections and sets the selection to the region specified ///