wpf - Connect StackPanels and Border with a line -
i have own control derives stackpanel. control contains 2 other controls, first border (with textblock inside) , stackpanel (able containes other stackpanels).
now, when new stackpanel added internal stackpanel draw line connect border new added stackpanel.
guess can handle in code, when need stackpanel added determine , border locations, , base on draw line. question is: can see other ways achieve same result? how can keep link between border , stackpanel when 1 of items dragging layout ? thank br jarek
you can super-easy way doing this:
<grid x:name="layoutroot" background="white"> <stackpanel> <border margin="10 0 0 0" borderbrush="black" borderthickness="5 0 0 0" > <textblock text="mytext" margin="5 0 0 0 " /> </border> <stackpanel margin="10 0 0 0" orientation="vertical"> <border borderbrush="black" borderthickness="5 0 0 0"> <textblock text="sub-item 1" margin="15 0 0 0" /> </border> <border borderbrush="pink" borderthickness="5 0 0 0"> <textblock text="sub-item 2" margin="15 0 0 0" /> </border> <border borderbrush="black" borderthickness="5 0 0 0"> <textblock text="sub-item 3" margin="25 0 0 0" /> </border> </stackpanel> </stackpanel> </grid>
Comments
Post a Comment