Completed
Last Updated: 19 Jun 2017 12:19 by ADMIN
ADMIN
Hristo
Created on: 06 Apr 2017 11:19
Category: GridView
Type: Bug Report
1
FIX. RadGridView - when the control is grouped pinning the last row of a group makes the row to visually disappear
How to reproduce: check the attached video

Workaround: disable pinning of the last row when it is in a group
public partial class Form1 : Form
{
    DataTable dt;

    public Form1()
    {
        InitializeComponent();

        this.radGridView1.DataSource = this.GetData();
        this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

        this.radGridView1.ContextMenuOpening += RadGridView1_ContextMenuOpening;
    }

    private void RadGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
    {
        GridRowHeaderCellElement header = e.ContextMenuProvider as GridRowHeaderCellElement;
        if (header != null && header.RowInfo.Group != null)
        {
            var notPinned = header.RowInfo.Group.GroupRow.ChildRows.Where(r => r.IsPinned == false).ToList();
            if (notPinned.Count <= 1)
            {
                e.ContextMenu.Items.RemoveAt(0);
                e.ContextMenu.Items.RemoveAt(0);
            }
        }
    }

    private DataTable GetData()
    {
        dt = new DataTable();

        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Date", typeof(DateTime));
        dt.Columns.Add("Bool", typeof(bool));
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                dt.Rows.Add(i, "Name " + i + " " + j, DateTime.Now.AddDays(i), i % 2 == 0);
            }
        }

        return dt;
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments