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

Maintain Item Selection for subitems

4 Answers 139 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ryan Black
Top achievements
Rank 1
Ryan Black asked on 18 May 2010, 03:10 PM
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

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 24 May 2010, 11:49 AM
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.
0
Ryan Black
Top achievements
Rank 1
answered on 24 May 2010, 01:38 PM
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

0
Accepted
Dimitrina
Telerik team
answered on 27 May 2010, 01:20 PM
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.
0
Ryan Black
Top achievements
Rank 1
answered on 27 May 2010, 01:56 PM
That is exactly what I was looking for.

Thanks so much
Ryan
Tags
TreeView
Asked by
Ryan Black
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ryan Black
Top achievements
Rank 1
Share this question
or