Completed
Last Updated: 01 Jun 2015 14:47 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 19 Feb 2015 10:46
Category: GridView
Type: Bug Report
0
FIX. RadGridView - dragging a column from ColumnChooser and dropping it into a group in the ColumnGroupsViewDefinition makes the column empty
To reproduce: use the following code snippet and follow the steps illustrated on the attached gif file:

private void Form1_Load(object sender, EventArgs e)
{
    this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
    this.radGridView1.DataSource = this.customersBindingSource;
    this.radGridView1.BestFitColumns(BestFitColumnMode.AllCells);
    ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
    view.ColumnGroups.Add(new GridViewColumnGroup("Customer Contact"));
    view.ColumnGroups.Add(new GridViewColumnGroup("Details"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Contact"));
    view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CompanyName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactTitle"]);

    view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Address"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]);

    view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Fax"]);
    radGridView1.ViewDefinition = view;
}

Sometimes the incorrect behavior is obtained immediately after you drop the column, but you need to scroll the horizontal scroll-bar to replicate it.

Workaround:
RadGridViewDragDropService svc = this.radGridView1.GridViewElement.GetService<RadGridViewDragDropService>();
svc.Stopped += svc_Stopped;

private void svc_Stopped(object sender, EventArgs e)
{
    int horizontalScrollvalue = this.radGridView1.TableElement.HScrollBar.Value;
    this.radGridView1.MasterTemplate.Refresh();
    this.radGridView1.TableElement.HScrollBar.Value = horizontalScrollvalue;
}

Attached Files:
0 comments