The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
In my grid I would like users to be able to click in any frozen column to select the whole row. I have cols.headcount = -1 as I don't want any row headers. ListBoxSelectionMode is set to None as I would like to retain normal per-cell/cell range selection in the rest of the grid. I have used the following code yet this only works ok for single row selections - I would like to retain CTRL and SHIFT-selection for rows. Private Sub GridControl1_CellClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs) Handles GridControl1.CellClick
Dim grid As GridControl = CType(sender, GridControl)
'clicking in any of the frozen columns should select the whole row If e.ColIndex > 0 And e.ColIndex < grid.Cols.FrozenCount Then e.Cancel = True grid.Model.Selections.Add(GridRangeInfo.Row(e.RowIndex)) End If
HAhaneefm Syncfusion Team June 19, 2007 04:02 PM UTC
Hi Richard,
You can try these code snippet.
Private Sub GridControl1_CellClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs) Handles GridControl1.CellClick 'clicking in any of the frozen columns should select the whole row If e.ColIndex > 0 And e.ColIndex < GridControl1.Cols.FrozenCount Then e.Cancel = True If Control.ModifierKeys() = Keys.Control Then GridControl1.Model.Selections.Add(oldSelection); If GridControl1.Model.SelectedRanges.AnyRangeIntersects(GridRangeInfo.Row(e.RowIndex)) Then GridControl1.Model.Selections.Remove(GridRangeInfo.Row(e.RowIndex)) Else GridControl1.Model.Selections.Add(GridRangeInfo.Row(e.RowIndex)) End If ElseIf Control.ModifierKeys() = Keys.Shift Then GridControl1.Model.Selections.Add(GridRangeInfo.Rows(GridControl1.CurrentCell.MoveFromRowIndex(), e.RowIndex)) Else GridControl1.Model.Selections.Add(GridRangeInfo.Row(e.RowIndex)) End If End If End Sub
Best regards, Haneef
RBRichard BysouthJune 20, 2007 12:04 AM UTC
Haneef
What is the variable "oldSelection" in that code snippet? Not sure where this should be defined or where its value is set.
thanks
Richard
HAhaneefm Syncfusion Team June 20, 2007 09:14 PM UTC
Hi Richard,
Here is a minimal sample that shows you "How to implement the MultiExtend selection behavior in grid when you click on the frozen column?" GridStyleSample.zip