I'm using VirtualGrid as a calendar with months as columns and days as rows. The default selection mode is row-wise. I'd like to change it column-wise.
Let's say I select a range in the grid from 1st of feb (rowindex 0, columnindex 1) to 2nd of march (row 1, col 2). The selected cells are (0,1) (0,2) (1,1) (1,2). In my grid the selected cells should be (0,1) to (0,28) (1,1) (1,2).
I tried to implement the SelectionChanging event but I didn't got it working. Neither the actual selection is canceled nor the new selection is executed.
Private Sub RadVirtualGrid1_SelectionChanging(sender As Object, e As VirtualGridSelectionChangingEventArgs) Handles RadVirtualGrid1.SelectionChanging
If e.SelectionAction = VirtualGridSelectionAction.ExtendSelection Then
If RadVirtualGrid1.Selection.SelectedRegion.Left <> RadVirtualGrid1.Selection.SelectedRegion.Right Then
e.Cancel = True
Dim first_top As Integer = RadVirtualGrid1.Selection.SelectedRegion.Top
Dim last_bottom As Integer = RadVirtualGrid1.Selection.SelectedRegion.Bottom
Dim curr_top As Integer = first_top
Dim curr_bottom = ROW_OFFSET + 31
For col As Integer = RadVirtualGrid1.Selection.SelectedRegion.Left To RadVirtualGrid1.Selection.SelectedRegion.Right
RadVirtualGrid1.Selection.BeginSelection(curr_top, col, RadVirtualGrid1.Selection.SelectedRegion.ViewInfo, True)
curr_top = ROW_OFFSET
If col = RadVirtualGrid1.Selection.SelectedRegion.Right - 1 Then
curr_bottom = last_bottom