Completed
Last Updated: 01 Oct 2014 13:03 by ADMIN
ADMIN
Stefan
Created on: 10 Mar 2014 08:29
Category: TreeView
Type: Bug Report
1
FIX. RadTreeView - when ShowRootLines and ShowLines are false, root nodes with no children are incorrectly indented
To reproduce: 


protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);


    radTreeView1 = new RadTreeView();
    radTreeView1.Parent = this;


    for (int i = 0; i < 5; i++)
    {
        RadTreeNode n1 = new RadTreeNode("Node" + i);
        this.radTreeView1.Nodes.Add(n1);
        if (i % 2 == 0)
        {
            for (int j = 0; j < 2; j++)
            {
                RadTreeNode n2 = new RadTreeNode("Node" + i + "." + j);
                n1.Nodes.Add(n2);


                if (j % 2 == 0)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        RadTreeNode n3 = new RadTreeNode("Node" + i + "." + j + "." + k);
                        n2.Nodes.Add(n3);
                    }
                }
            }
        }
    }
    radTreeView1.ShowRootLines = false;
    radTreeView1.ShowLines = false;
}


Workaround:

void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
{
    if (radTreeView1.ShowLines == false)
    {
        if (e.NodeElement.LinesContainerElement.Children.Count > 0)
        {
            TreeNodeLineElement lineElement = (TreeNodeLineElement)e.NodeElement.LinesContainerElement.Children[0];
            lineElement.Visibility = ElementVisibility.Collapsed;
        }
    }
}
0 comments