views:

31

answers:

2

Hey all, I've noticed that if I have a style setup for a treeview, and a different one setup for the treeviewitem, it gets overridden once I put the item in the tree. Does anyone have suggestions for how to control the style of each treeviewitem individually while mantaining a default style that is applied to the whole treeview? Basically I want to make the text of my treeviewitem red depending on a data field in the item. Otherwise I want it to be black. Thanks

A: 

DataTemplateSelector is not in Silverlight. Try below link

http://blog.timmykokke.com/archive/2009/09/28/datatemplateselector-in-silverlight.aspx

Ragunathan
I'm not looking for how to change a data template, that part is fine. I need ot know how to change the style. Unforunately, I cannot simply add Setters because the Style.Setters collection says its read only. Does that mean you cannot change the style during runtime? Thanks
JGord
I think this is nice article based on your need.http://www.tozon.info/blog/post/2009/03/15/Dynamic-Data-Forms-for-Silverlight-with-a-Data-Template-Selector-Control.aspx
Ragunathan
Thanks, turns out it was TreeViewItem.Style CAN be set to an ItemContainerStyle if you use the objects as references.
JGord
A: 

Thanks, turns out it was TreeViewItem.Style CAN be set to an ItemContainerStyle if you use the objects as references.

JGord