Hide Expander

4 posts, 0 answers
  1. Terry Foster
    Terry Foster avatar
    60 posts
    Member since:
    Sep 2009

    Posted 02 Nov 2010 Link to this post

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

    Posted 05 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. Terry Foster
    Terry Foster avatar
    60 posts
    Member since:
    Sep 2009

    Posted 05 Nov 2010 Link to this post

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

    Posted 05 Nov 2010 Link to this post

    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
Back to Top