c# - WPF TreeView Remove drawn lines (ReDraw) -


because normal treeview doesn't fit needs, created own treeview, inherit treeview , draw lines between treeviewitems. enter image description here

so far good, redraw (remove add lines) after tree has been built , drawn. in onrender method, provides drawingcontext draw lines.

            //point connections parent childs.             point parentstart = parentcenter;             point parentend = new point(parentcenter.x, middleparentchild);             point childend = new point(childcenter.x, middleparentchild);             point childstart = childcenter;              drawingcontext.drawline(pen, parentstart, parentend);             drawingcontext.drawline(pen, parentend, childend);             drawingcontext.drawline(pen, childend, childstart);              //recursivly children             drawconnections(pen, drawingcontext, item); 

but have no access drawingcontext after control has been rendered once. saved in lokal variable, not able remove drawn shapes nor redraw anything, because drawingcontext disposed.

you can use yourtreeview.invalidatevisual() redraw tree.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

ios - Change Storyboard View using Seague -

verilog - Systemverilog dynamic casting issues -