Maintain Item Selection for subitems

5 posts, 1 answers
  1. Ryan Black
    Ryan Black avatar
    54 posts
    Member since:
    Mar 2010

    Posted 18 May 2010 Link to this post

    Hello again,

    To keep this post fairly short I will reference the great code you have provided from http://www.telerik.com/community/forums/wpf/treeview/select-entire-row-and-remove-expand-buttons.aspx

    I would like the SelectionVisual Border to stay highlighted on the main tree item if a user goes deeper into the tree.  I am also trying to change the foreground color of the item if selected.

    I was thinking that I needed to have a ItemContainerStyle for each HierarchicalDataTemplate "layer" in the treeview to achieve the desired result.  Is this the best way?

    I am including a reference picture to better illustrate what I am talking about.  I have already done the expander.


    Thanks again,
    Your controls and help save us lots of time :)

    Ryan

  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 24 May 2010 Link to this post

    Hi Ryan,

    You can allow TreeView's MultipleSelection and when the user selects a child node, you can make sure that the parent (or other custom logic) is also selected. That way the SelectionVisualBorder will stay for the items you want.
    About ItemContainerStyle - its ok to have different Styles for each level, if you all levels looks different.

    Please find attached an example.

    If you have further questions please do not hesitate to ask us.
    I hope this will help you.


    Greetings,
    Dimitrina
    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. UI for WPF is Visual Studio 2017 Ready
  4. Ryan Black
    Ryan Black avatar
    54 posts
    Member since:
    Mar 2010

    Posted 24 May 2010 Link to this post

    Thanks for the code example.  I seem to be missing something from the code, because when I select a sub item, the main tree item becomes unselected.  I added SelectionMode="Multiple" to the example, but that did not seem to fix the problem.

    I have attached an image for better clarification.

    Ryan

  5. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 27 May 2010 Link to this post

    Hi Ryan,

    Please find attached an example.

    If you have further questions please do not hesitate to ask us.
    I hope this will help you.

    Kind regards,
    Dimitrina
    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.
  6. Ryan Black
    Ryan Black avatar
    54 posts
    Member since:
    Mar 2010

    Posted 27 May 2010 Link to this post

    That is exactly what I was looking for.

    Thanks so much
    Ryan
Back to Top
UI for WPF is Visual Studio 2017 Ready