This is a migrated thread and some comments may be shown as answers.

Hide Expander

3 Answers 122 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Terry Foster
Top achievements
Rank 1
Terry Foster asked on 02 Nov 2010, 04:43 PM
What's the best way to NOT display the expander for all of my top-level tree view items?  I basically want my top-level items to act as categories that are always expanded and cannot be collapsed by the user, and save some real-estate at the same time (all within the same RadTreeView control).  All of my items are declared in XAML, but knowing if there is a way to bind and dynamically update this would also be useful.

Thanks,
Terry

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 05 Nov 2010, 01:43 PM
Hi Terry Foster,

In order to prevent the collapsing of the first level items, you can handle the PreviewCollapsed event of the RadTreeView as I have demonstrated in the attached project.
Hiding the expander icon could be done via the ExpanderStyle property of the RadTreeView. You can check out his article showing the way to use it
http://www.telerik.com/help/silverlight/radtreeview-styling-and-appearance-styling-expander.html.
The bad news is that the property applies to all of the RadTreeViewItems.  However, we have logged this as a feature request in our PITS system http://www.telerik.com/support/pits.aspx#/public/silverlight/2394 where you can vote for it.

Also, we don`t understand what you mean with "save some real-estate at the same time (all within the same RadTreeView control)",  so can you elaborate more on this?
 
Please feel free to ask if you need more info. We would be glad to help you.

Regards,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Terry Foster
Top achievements
Rank 1
answered on 05 Nov 2010, 02:05 PM
Sorry for not being clearer.  What I mean is, if I can hide the expanders for just the top-level nodes, then the overall width of my tree view can be thinner, saving some real estate in my UI.  For example, in the attached image file, we would prefer the left screen shot over the right one.  I know we could achieve this with three different tree views, each with a TextBlock caption, but we only want one item selected at a time, which is much more conveniently managed with a single tree view.

Thanks for the response,
Terry
0
Petar Mladenov
Telerik team
answered on 05 Nov 2010, 04:17 PM
Hello Terry Foster,

Thank you for the clarification. You can edit the ControlTemplate of the RadTreeViewItems and to apply it to the first level items. Setting the  ListRootContainer`s MinWidth to 0  and the Expander `s Visibility to Collapsed solves your issue.
You can examine the attached solution and let us know if it satisfies you completely.

We would be glad if we can assist you further.

Best wishes,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Terry Foster
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Terry Foster
Top achievements
Rank 1
Share this question
or