views:

29

answers:

1

I have an items template and I want to highlight some text in a dark color. The problem is that the text starts out as black so I can't read it when it is highlighted.

What is the best way to turn the text white or reverse highlight it when my mouse goes over the parent border (that is the highlight element)

A: 

In your Item Template, you must display content within a new ContentControl and you must change ForeColor property of ContentControl in highlighted state of item template.

Akash Kava
My textblock has the color blue assigned to the foreground... wont this prevent the color from changing?
zachary
yes it will prevent, but in highlighted state of your item, you can change text block's foreground right? Unless you are using rich text, you should avoid using text block and use content presenter or content control only, that will give you more control over styling.
Akash Kava
This is where my confusion is I think... I am using a telerik treeview. The mouseover visual state is somewhere else. Then I override itemscontrol with my own template of textblocks... the problem being that I can't see the visual state at this point... So I can't change the color. Unless I am missing something?
zachary
Ok i forgot to mention, you have to add Item Container style for Tree/list controls, you can define states in item container style, in blend you can do this by creating "Item Container Style", you can find it in context menu.
Akash Kava