Unplanned
Last Updated: 30 Mar 2016 13:29 by ADMIN
ADMIN
Georgi I. Georgiev
Created on: 19 Dec 2013 10:54
Category: TreeView
Type: Bug Report
1
FIX. RadTreeView - scrolling while adding nodes and with asynchronous scrolling gets the tree in an invalid state
To reproduce:
Add a RadTreeView and a Timer(from the Windows.Forms namespace). Set the timer's interval to some short duration and add nodes to tree on its tick event. Scroll the thumb while the timer is ticking. At some point you will notice that the scrollbar's maximum value is not correct.

Workaround:
Do not add nodes while scrolling:
List<string> cachedValues = new List<string>();
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer() { Interval = 100 };

void radTreeView1_MouseCaptureChanged(object sender, EventArgs e)
{
    timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
    timer.Stop();
    if (this.cachedValues.Count > 0 && !radTreeView1.TreeViewElement.Scroller.Scrollbar.ThumbElement.Capture)
    {
        foreach (string value in this.cachedValues)
        {
            root.Nodes.Add(value);
        }

        cachedValues.Clear();
    }
}

private void timerUpdateNodes_Tick(object sender, EventArgs e)
{
    for (int i = 0; i < 10; ++i)
    {
        if (random.NextDouble() < .2)
        {
            if (radTreeView1.TreeViewElement.Scroller.Scrollbar.ThumbElement.Capture)
            {
                cachedValues.Add("Node");
            }
            else
            {
                root.Nodes.Add("Node");
            }
        }
    }
}
0 comments