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

[Solved] RadTreeViewItem Foreground property is changing all children also

4 Answers 79 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Happy
Top achievements
Rank 1
Happy asked on 27 Aug 2009, 05:52 PM
I'm dynamically creating my tree nodes at the client. I create a RadTreeViewItem and add it to the tree. As I traverse my structure, adding the items, if any item represents overridden data, I'm trying to draw those items of the hierarchy in a different color to help users find those tree nodes that have overridden data.

Whenever I set the foreground property of a treeviewitem to my new color, all it's children all the way down it's hierarchy are also changed to the same color. I only want to change the color of that specific treeviewitem. I'm walking the hierarchy up from there and also changing all the parent's to the new color.

Am I doing something wrong?

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 28 Aug 2009, 07:18 AM
Hello Happy,

This is correct behavior - the parent treeview item is containing its child items that is why its size is so big.

What you can do is to set white background to the child items which will overlay the background set from its parent item.

Sincerely yours,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 28 Aug 2009, 12:17 PM
I'm setting the foreground property, NOT the background.
0
Accepted
Valentin.Stoychev
Telerik team
answered on 28 Aug 2009, 12:22 PM
Hello Happy,

Sorry - my bad!

The Foreground property is inheritable - if you set it on a parent element it propagates into its children. that is why it happens in the treeview also. You just need to set each node Foreground color in this case.

Regards,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 28 Aug 2009, 01:01 PM
Thanks! That worked.
Tags
TreeView
Asked by
Happy
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Happy
Top achievements
Rank 1
Share this question
or