Completed
Last Updated: 07 Apr 2016 11:11 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 31 Mar 2016 06:08
Category: VirtualGrid
Type: Bug Report
0
FIX. RadVirtualGrid - multiple selection is cleared when opening the context menu
To reproduce:

1. Select multiple cells in RadVirtualGrid
2. Right-click one of the selected cells. The expected behavior is to open the context menu in order to allow copy operation and keep the selected cells. However, the obtained result is that the selected cells are cleared.

Workaround:
Me.RadVirtualGrid1.VirtualGridElement.InputBehavior = New CustoVirtualGridInputBehavior(Me.RadVirtualGrid1.VirtualGridElement)
AddHandler Me.RadVirtualGrid1.SelectionChanging, AddressOf SelectionChanging

Private Sub SelectionChanging(sender As Object, e As Telerik.WinControls.UI.VirtualGridSelectionChangingEventArgs)
    If Me.RadVirtualGrid1.VirtualGridElement.Tag = "CancelSelectionChange" Then
        e.Cancel = True
        Me.RadVirtualGrid1.VirtualGridElement.Tag = Nothing
    End If

End Sub

Public Class CustoVirtualGridInputBehavior
Inherits VirtualGridInputBehavior
    Public Sub New(gridElement As RadVirtualGridElement)
        MyBase.New(gridElement)

    End Sub

    Public Overrides Function HandleMouseDown(args As MouseEventArgs) As Boolean
        If args.Button = MouseButtons.Right Then
            Dim cell As VirtualGridCellElement = TryCast(Me.GridElement.ElementTree.GetElementAtPoint(args.Location), VirtualGridCellElement)
            If cell IsNot Nothing AndAlso cell.IsSelected Then
                Me.GridElement.Tag = "CancelSelectionChange"
            End If

        End If 
        Return MyBase.HandleMouseDown(args)
    End Function 
End Class
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments