Disable Expand All

3 posts, 0 answers
  1. Graham
    Graham avatar
    2 posts
    Member since:
    Jun 2011

    Posted 26 Nov 2013 Link to this post

    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. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Nov 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Graham
    Graham avatar
    2 posts
    Member since:
    Jun 2011

    Posted 02 Dec 2013 Link to this post

    Hi Petar

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

    Kind Regards
    Graham
Back to Top