locked
TreeView with item left aligned of + RRS feed

  • Question

  • Hello everyone,

    Is there a way in a treeview, to have items left of the +?


    Item1            + Group1
    Item2            -  Group2
    Item3                    X
    Item4                    Y

    I would like the Item1-4 to be part of a treeview row, so that when I click on -, Group2, Item2-Item4 disapear.

    I would apprishate any kind of help very much, Thanks!
    Thursday, July 31, 2008 6:39 AM

Answers

  • ListView        TreeView
    |------|           |-----------|
    Item1            + Group1                         Row1
    Item2            -  Group2                         Row2
    Item3                    X                              ......
    Item4                    Y

    The Composite Pattern Data Structure which holds the hirarchical Data for the TreeView controls the ListView. I synchronized the Hights of each Row between the two DataContents. it was not easy, but this way I can use all the rich functionallity of the Tree- and listView instead of implementing it from scratch on my on.
    The Final Layout is sort of a advanced C# editor with Linenumbers (ListView).
    • Marked as answer by Marco Zhou Wednesday, August 6, 2008 9:47 AM
    Wednesday, August 6, 2008 5:08 AM

All replies

  • Here you can find an example of such tree. Article is not big so I propose you to read all 3 parts. Using such (level -> margin) converter with TreeView class seems to be simplest way to do what you want.


    Developer
    • Proposed as answer by Ilya Margolin Sunday, August 3, 2008 12:42 PM
    Sunday, August 3, 2008 12:42 PM
  • Thanks for your effort, your sugestion was not exactly what I was looking for, I have solved the problem by now, thanks!
    Tuesday, August 5, 2008 6:13 AM
  • Could you please give the brief description/link of how you solved it? Because I've seen at least two more questions very similar to your. It seems to be very popular problem.

    Developer
    Tuesday, August 5, 2008 10:03 PM
  • ListView        TreeView
    |------|           |-----------|
    Item1            + Group1                         Row1
    Item2            -  Group2                         Row2
    Item3                    X                              ......
    Item4                    Y

    The Composite Pattern Data Structure which holds the hirarchical Data for the TreeView controls the ListView. I synchronized the Hights of each Row between the two DataContents. it was not easy, but this way I can use all the rich functionallity of the Tree- and listView instead of implementing it from scratch on my on.
    The Final Layout is sort of a advanced C# editor with Linenumbers (ListView).
    • Marked as answer by Marco Zhou Wednesday, August 6, 2008 9:47 AM
    Wednesday, August 6, 2008 5:08 AM