Completed
Last Updated: 27 Dec 2016 11:02 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 15 Dec 2016 07:18
Category: VirtualGrid
Type: Bug Report
1
FIX. RadVirtualGrid - NullReferenceException when cancelling the CurrentCellChanging event
To reproduce: use the following code snippet and try to select another cell.

public RadForm1()
{
    InitializeComponent();

    this.radVirtualGrid1.RowCount = 30;
    this.radVirtualGrid1.ColumnCount = 5;
    this.radVirtualGrid1.CellValueNeeded += radVirtualGrid1_CellValueNeeded;
      
    this.radVirtualGrid1.CurrentCellChanging += radVirtualGrid1_CurrentCellChanging;
}

private void radVirtualGrid1_CurrentCellChanging(object sender, Telerik.WinControls.UI.VirtualGridCellInfoCancelEventArgs e)
{
    e.Cancel = true;
}

private void radVirtualGrid1_CellValueNeeded(object sender, Telerik.WinControls.UI.VirtualGridCellValueNeededEventArgs e)
{
    e.Value = e.RowIndex + "." + e.ColumnIndex;
}

Workaround:

public class CustomVirtualGrid : RadVirtualGrid
{
    public override string ThemeClassName  
    { 
        get 
        { 
            return typeof(RadVirtualGrid).FullName;  
        }
    }

    protected override void OnMouseDown(MouseEventArgs e)
    {
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            return;
        }
        base.OnMouseDown(e);
    }
}

Attached Files:
0 comments