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

Disable Expand All

2 Answers 9 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Graham
Top achievements
Rank 1
Graham asked on 26 Nov 2013, 01:50 PM
Hi
First post here. Have really loved the trial of the Silverlight Controls, so bought the product.

I'm mainly using the Silverlight Treeview at the moment, the choice being made because of the virtualisation which the Silverlight Toolkit version didn't offer. I have a tree with ~130000 nodes, being semi built on demand, such that the first few levels are loaded straight away and then when a node is expanded, I fetch its grand-children, having already got its children. It means that the user experience is reasonably good.

One thing I do need to do with that volume of nodes is to prevent the user from Expanding All nodes, by pressing * on the numeric keypad or whatever other methods there are and this is particularly vital when at the top of the tree. Further down, I can live with, but an all or nothing approach is fine.

What's the best way of achieving this? I am using an MVVM approach, so am guessing an attached behaviour of some kind is needed?

Many thanks
Graham

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 29 Nov 2013, 08:59 AM
Hello Graham,

We understand your requirement. Currently there is no out of the box way to achieve it. However, you can inherit the RadTreeView and the RadTreeViewItem and override their OnKeyDown methods like so:
protected override void OnKeyDown(KeyEventArgs e)
       {
           if (e.Key == Key.Multiply)
           {
               return;
           }
           base.OnKeyDown(e);
       }
You can find this demonstrated in the attached projet. We hope it will help you proceed further.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Graham
Top achievements
Rank 1
answered on 02 Dec 2013, 11:46 AM
Hi Petar

Many thanks for this. It has solved my immediate need.

Kind Regards
Graham
Tags
TreeView
Asked by
Graham
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Graham
Top achievements
Rank 1
Share this question
or