Completed
Last Updated: 16 Jun 2016 10:15 by ADMIN
ADMIN
Dimitar
Created on: 14 Jun 2016 08:27
Category: GridView
Type: Bug Report
0
FIX. RadGridView - exception when the data source is changed in CellValueChanged event and a header context menu is shown.
To reproduce:
- Bind the grid and reset its data source in the CellValueChanged event handler.
- Start the application, click in a cell, delete the contents and right click a header cell.
- Exception is thrown.

Workaround:

class MyGridHeaderCellElement : GridHeaderCellElement
{
    public MyGridHeaderCellElement(GridViewColumn col, GridRowElement row) : base(col, row)
    { }
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GridHeaderCellElement);
        }
    }
    protected override void ShowContextMenu()
    {
        if (this.ViewTemplate != null)
        {
            base.ShowContextMenu();
        }
      
    }
}
private void RadGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridHeaderCellElement))
    {
        e.CellType = typeof(MyGridHeaderCellElement);
    }
}

0 comments