Completed
Last Updated: 13 Oct 2015 10:19 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 22 Oct 2014 08:38
Category: GridView
Type: Bug Report
0
FIX. RadGridView - vertical scroll bar range is not correct when expanding child view
To reproduce: use the following code snippet and follow the steps in the attached gif file.

private void Form1_Load(object sender, EventArgs e)
{
    this.order_DetailsTableAdapter.Fill(this.nwindDataSet.Order_Details);
    this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);
    radGridView1.AutoGenerateHierarchy = true;
    radGridView1.DataSource = this.nwindDataSet;
    radGridView1.DataMember = "Orders";
    radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGridView1.MasterTemplate.Templates.First().AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGridView1.EnablePaging = true;

    radGridView1.MasterTemplate.Templates.First().EnableFiltering = true;
    FilterDescriptor fd = new FilterDescriptor();
    fd.PropertyName = "UnitPrice";
    fd.Operator = FilterOperator.IsGreaterThan;
    fd.Value = 40;
    radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Add(fd);
    
    radGridView1.MouseDown += radGridView1_MouseDown;
}

private void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    GridDetailViewCellElement detailCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDetailViewCellElement;
    if (detailCell != null)
    {
        radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Clear();
    }
}


Workaround:

private void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    GridDetailViewCellElement detailCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDetailViewCellElement;
    if (detailCell != null)
    {
        radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Clear();
        GridViewHierarchyRowInfo hierarchyRow = (GridViewHierarchyRowInfo)((GridViewDetailsRowInfo)detailCell.RowInfo).Owner;
        hierarchyRow.IsExpanded = ! hierarchyRow.IsExpanded;
        hierarchyRow.IsExpanded = ! hierarchyRow.IsExpanded;
        hierarchyRow.ChildRows.Last().EnsureVisible();
    }
}
Attached Files:
0 comments