RadTreeViewItem Level and StyleSelector

3 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Feb 2012

    Posted 12 Mar 2012 Link to this post

    I'm using a StyleSelector to set the style of the different Items in my  RadTreeView, and I noticed that, when the item is analyzed by the StyleSelector to choose a style, i.e. at the SelectStyle method, the Level of the container is not set. Is this by design or a bug?

    If by design, where is it documented? The functionality I'm trying to implement is expanding everything up to the fourth level of my tree view, how can I do this without using the Level property in the Style selector?
  2. David
    David avatar
    2 posts
    Member since:
    Feb 2012

    Posted 12 Mar 2012 Link to this post

    Just figured out I'll use the ItemPrepared event to handle the Level issue, but I'd still like to know where is this issue documented or why is it not documented.
  3. DevCraft banner
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Mar 2012 Link to this post

    Hello David ,

     Yes this is by design, the Level property is set later than the SelectStyle method. I believe we haven't documented this because we have never received a reported that this might be an issue in particular scenarios. Could you please elaborate more on yours? If expanding particular nodes is your main goal, this is usually achieved with databinding. The RadTreeView is bound to collection of ViewModels and a boolean property from the ViewModel class is bound to the IsExpanded property of the RadTreeViewItem via StyleBindings(WPF 4, SL5) or ContainerBindings(SL4).

    Greetings,
    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top