Find Parent node in treeview

i want to hide line marked as red if the node was parent node. and align correctly this is custom treelayout . can you help

$(go.Panel, "Horizontal",
                {
                    name: "indentPanel",
                    alignment: go.Spot.Left, // This spot gets modified by the layout to be more indented
                    alignmentFocus: go.Spot.Left

                },


                $("TreeExpanderButton", // support expanding/collapsing subtrees
                    {
                        width: 14,
                        height: 14,
                        "ButtonIcon.stroke": "lightgray",
                        "ButtonIcon.strokeWidth": 1,
                        "ButtonBorder.fill": "white",
                        "ButtonBorder.figure": "Rectangle",
                        margin:6

                    }
                ),

                $(go.Panel, "Horizontal", {
                        position: new go.Point(18, 0)

                    },
                $(go.Shape, "LineV",
                    new go.Binding("visible", "toNode", function (n) {
                        if (n.data.brush) return n.data.brush;
                        return "lightgray";
                    }).ofObject(),
                    {  stroke: "lightgray", width: 1,
                        height: 25

                    }
                ),

                $(go.Shape, "LineH", {
                    width: 13,
                    height: 22,
                    stroke: "lightgray"


                }

                ),

                    $(go.TextBlock,
                        {margin: 2, name: "MAINTXT" },
                        new go.Binding("isUnderline", "underline"),
                        //new go.Binding("font", "bold"),



                        {font: '8pt Verdana, sans-serif', margin: 8},
                        new go.Binding('margin', 'isTreeLeaf', function (leaf) {
                            return leaf ? leafMargin : 5;
                        }).ofObject(),
                        new go.Binding("text"))



                ),

Add:

new Binding('visible', 'isTreeLeaf', function(isLeaf) { return isLeaf; }).ofObject(),

to the lineV:

$(go.Shape, "LineV",
    new go.Binding("visible", "toNode", function (n) {
        if (n.data.brush) return n.data.brush;
        return "lightgray";
    }).ofObject(),
    new Binding('visible', 'isTreeLeaf', function(isLeaf) { return isLeaf; }).ofObject(),
    {  stroke: "lightgray", width: 1,
        height: 25

    }
),

Note that you have this other “visible” binding too, I’m not sure the purpose of it but it may conflict.

Thanks Simon

That first “visible” Binding can’t be right. GraphObject.visible is a boolean property, so the converter cannot return a string.