locked
Customizing Treeview Control in Silverlight RRS feed

  • Question

  • Hi, 

    I am working on silverlight Treeview control, I need to customize the treeview in such a way, that only one item can be expanded at a time, if first item is expanded currently, when i expand the second item, the first item should automatically close. meaning- i want only one Item to expand at an instance.

    Any help is appreciated,

    Thank you.

    Tuesday, March 1, 2011 9:47 AM

Answers

  • You can embed an accordion in the template of 1st level items, that can be a way.

    The problem is that the treeview code has not been created to act as an accordion control... You can template it all the day, you'll always get the behavior of a treeview.

    So, the other way in this situation is to create a new control doing what you want. Developing with .NET means also creating new control when needed... Take the starting code from trreeview and get inspiration from accordion code, both are in the toolkit, so with full source code.

    Wednesday, March 2, 2011 5:16 PM

All replies

  • perhaps you look at the code of the accordion, who acts exactly this way..

    Wednesday, March 2, 2011 12:29 AM
  • Thanks for your reply,

    perhaps, i had treid using accordion, but i need the feature to be implemented in Treeview control, Any idea on that?

    Wednesday, March 2, 2011 8:39 AM
  • You can embed an accordion in the template of 1st level items, that can be a way.

    The problem is that the treeview code has not been created to act as an accordion control... You can template it all the day, you'll always get the behavior of a treeview.

    So, the other way in this situation is to create a new control doing what you want. Developing with .NET means also creating new control when needed... Take the starting code from trreeview and get inspiration from accordion code, both are in the toolkit, so with full source code.

    Wednesday, March 2, 2011 5:16 PM