Completed
Last Updated: 01 Dec 2015 08:27 by ADMIN
ADMIN
Hristo
Created on: 21 Oct 2015 11:45
Category: GridView
Type: Bug Report
0
FIX. RadGridView - when the is in SplitMode, resizing the "splitter" updates the scrollbar
How to reproduce:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.radGridView1.DataSource = this.GetData();
        this.Load += Form1_Load;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        this.radGridView1.SynchronizeCurrentRowInSplitMode = true;
        this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical;
    }

    private DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Age", typeof(int));
        dt.Columns.Add("Date", typeof(DateTime));
        dt.Columns.Add("Bool", typeof(bool));
        for (int i = 0; i < 100; i++)
        {
            dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false);
        }

        return dt;
    }
}



Workaround: 

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.radGridView1.DataSource = this.GetData();
        this.radGridView1.ViewDefinition = new SplitViewDefintion();
        this.Load += Form1_Load;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        this.radGridView1.SynchronizeCurrentRowInSplitMode = true;
        this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical;
    }

    private DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Age", typeof(int));
        dt.Columns.Add("Date", typeof(DateTime));
        dt.Columns.Add("Bool", typeof(bool));
        for (int i = 0; i < 100; i++)
        {
            dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false);
        }

        return dt;
    }
}

public class SplitViewDefintion : TableViewDefinition
{
    public override IRowView CreateViewUIElement(GridViewInfo viewInfo)
    {
        return new MyGridTableElement();
    }
}

public class MyGridTableElement : GridTableElement
{
    protected override RadScrollBarElement CreateScrollBarElement()
    {
        return new MyRadScrollbarElement();
    }
}

public class MyRadScrollbarElement : RadScrollBarElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadScrollBarElement);
        }
    }

    protected override void OnMouseDown(MouseEventArgs e)
    {
        if (Cursor.Current == Cursors.SizeWE || Cursor.Current == Cursors.SizeNS)
        {
            return;
        }

        base.OnMouseDown(e);
    }
}

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