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

Disabling and Hiding Expander in Tree control

5 Answers 474 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Balaram Barange
Top achievements
Rank 1
Balaram Barange asked on 18 Sep 2009, 01:12 PM
Hi,
In our application we have a requirement in which we want to show a tree hierarchy in expanded state, we should not able to collapse it and no expander be shown.
How can we do it using RadTreeView ?

Regards,
Balaram Barange


5 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 18 Sep 2009, 01:58 PM
Hi Balaram Barange,

You have two options
1. Use the PreviewExpanded event and handle it if you want to stop the expand.
2. Use a StyleSelector and modify the Style for the expander by using the ExpanderStyle property and set the IsEnabled property to false.

Best wishes,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
William
Top achievements
Rank 1
answered on 05 Jul 2010, 10:24 AM
Hi,
I have a related question...What would be the best way to disable and hide the expander for the root item only?
Thanks,
Pete
0
Tina Stancheva
Telerik team
answered on 08 Jul 2010, 01:21 PM
Hi William,

You can use the ItemContainerStyleSelector property to apply a different style for the root items, where the expander is collapsed:
 
<ToggleButton x:Name="Expander" Background="{TemplateBinding Background}" IsTabStop="False" Visibility="Collapsed"/>

I prepared a sample project illustrating this approach. Please take a look at it and let me know if it works for you.

All the best,
Tina Stancheva
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
William
Top achievements
Rank 1
answered on 14 Jul 2010, 09:16 AM
Hi Tina,
Thanks for taking the time to make the example. It works as advertised and I understand what you're doing to make it happen.
 
It feels a little like overkill to have to recreate the 150 line RadTreeViewItem style resource just in order to change a single line and I have a funny feeling that I might have to create a style resource for each theme (but I may be wrong about that). Thats something I'd really prefer to stay away from because if the theme ever changed then I'd have to redefine the resource. Its not that I couldn't do it but its more about dealing with the maintenance issue.  I guess what I'm getting to is that it sure seems like a lot of work and that it would be nice to have an 'ExpanderVisibility' type of property to make it much easier to do.  For my project, designing the treeview control so that the root item doesn't have the expander is a minor usability concern. Its minor enough to where if it tkes a lot of code to support or brings up maintenance issues then I'd just skip it.

I appreciate your help,
Pete
0
Tina Stancheva
Telerik team
answered on 19 Jul 2010, 10:03 AM
Hello William,

Thank you for the feedback. Actually we have logged controlling the visibility of the expander as a feature request in our PITS where you can vote for it. And if the feature gathers enough popularity, we will definitely consider implementing it.

Any additional comments on the matter are highly appreciated.

Greetings,
Tina Stancheva
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
Balaram Barange
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
William
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or