Completed
Last Updated: 29 Sep 2016 14:33 by ADMIN
ADMIN
Dimitar
Created on: 04 Sep 2015 08:16
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - the end edit operation is not properly finished when the user scrolls while there is node in edit mode.
To reproduce:
- Add a lot of nodes to the tree (scrollbars must appear).
- Use the following code to add nodes:
public RadForm1()
{
    InitializeComponent();
    radTreeView1.AllowEdit = true;
    RadContextMenu menu = new RadContextMenu();
    RadMenuItem add = new RadMenuItem();
    add.Click += add_Click;
    add.Text = "add";
    menu.Items.Add(add);
    radTreeView1.RadContextMenu = menu;

}
void add_Click(object sender, EventArgs e)
{
    RadTreeNode node = radTreeView1.SelectedNode;

    var newNode = node.Nodes.Add("new node");
    node.Expanded = true;
    radTreeView1.SelectedNode = newNode;
    radTreeView1.BeginEdit();
}
- Add a node and scroll

Workaround:
public RadForm1()
{
    InitializeComponent();
    radTreeView1.TreeViewElement.VScrollBar.Scroll += VScrollBar_Scroll;
    radTreeView1.MouseWheel += TreeViewElement_MouseWheel;
}

void TreeViewElement_MouseWheel(object sender, MouseEventArgs e)
{
    var radTreeView = sender as RadTreeView;
    if (radTreeView.IsEditing)
    {
        radTreeView.EndEdit();
    }
}

void VScrollBar_Scroll(object sender, ScrollEventArgs e)
{
    var radTreeView = (sender as RadScrollBarElement).ElementTree.Control as RadTreeView;
    if (radTreeView.IsEditing)
    {
        radTreeView.EndEdit();
    }
}

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