Completed
Last Updated: 27 Sep 2018 06:56 by Dimitar
ADMIN
Dimitar
Created on: 19 Sep 2018 08:01
Category: GridView
Type: Bug Report
0
FIX. RadGridView - header checkbox does not uncheck the rows when grouping is used
Use attached to reproduce.
- Check then try to uncheck the rows.

Workaround:
private void RadGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridCheckBoxHeaderCellElement))
    {
        e.CellElement = new MyHeaderCheckboxCellElement(e.Column, e.Row);
    }
}

class MyHeaderCheckboxCellElement : GridCheckBoxHeaderCellElement
{
    public MyHeaderCheckboxCellElement(GridViewColumn col, GridRowElement row) : base (col, row)
    { }
    protected override void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args)
    {
        base.checkbox_ToggleStateChanged(sender, args);
        var prop = this.ViewInfo.GetType().GetProperty("Version", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
        int value = (int)prop.GetValue(this.ViewInfo);
        prop.SetValue(this.ViewInfo, --value);

    }
}
Attached Files:
0 comments