Completed
Last Updated: 01 Oct 2014 13:03 by ADMIN
ADMIN
Stefan
Created on: 10 Mar 2014 08:19
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - nodes with children are not correctly positioned when ShowExpandCollapse is false and ShowRootLines is true
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 = true;
    radTreeView1.ShowExpandCollapse = false;
    radTreeView1.ShowLines = true;
}


WORKAROUND: 
        void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            if (radTreeView1.ShowExpandCollapse == false && radTreeView1.ShowRootLines == true)
            {
                if (e.Node.Parent == null && e.Node.Nodes.Count >0)
                {
                    TreeNodeLineElement lineElement = (TreeNodeLineElement)e.NodeElement.LinesContainerElement.Children[0];
                    lineElement.Visibility = ElementVisibility.Visible;
                    if (e.Node.Index==0)
                    {
                        lineElement.Type = TreeNodeLineElement.LinkType.RightTopAngleShape;
                    }
                    else if (e.Node.Index == radTreeView1.Nodes.Count -1)
                    {
                        lineElement.Type = TreeNodeLineElement.LinkType.RightBottomAngleShape;
                    }
                }
            }
        }
0 comments