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

how to change font color of hovered element

3 Answers 67 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kirill Kalinkin
Top achievements
Rank 1
Kirill Kalinkin asked on 10 Jun 2010, 02:47 PM
Hello!
I've faced up with such a simple task as changing font-color(or any other font property as FontWeight for example) on mouse hovering of the element. But I have no idea how to do that!
Thanks for any help!

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Jun 2010, 03:25 PM
Hello Kirill Kalinkin,

In order to change the foreground brush of the header in the RadTreeViewItem, you have to edit the control template of the RadTreeViewItem control in Blend and  you have to replace the ContentPresenter with ContentControl, because the ContentPresenter itself does not expose a Foreground property.

Please find attached an example.

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


Best wishes,
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
Kirill Kalinkin
Top achievements
Rank 1
answered on 10 Jun 2010, 04:01 PM
Thanks a lot!
It really helped me!
One more issue probably u know how I can solve it.
Im using MVVM pattern in my SL application.
and as ItemTemplate for RasTreeView control i'm using the folowing structure

<
telerik:HierarchicalDataTemplate x:Key="TreeTemplate" ItemsSource="{Binding MenuItems, Mode=OneWay}"><fiqas:FiqasButton Content="{Binding Title}" Template="{StaticResource btnAsTextblock}" x:Name="btnHeader" HorizontalAlignment="Left" Command="{Binding Command, Mode=OneWay}"/></telerik:HierarchicalDataTemplate> 

And everything works fine except the one thing. If I click on some item which is parent and that button doesnt contain any command then it will not expand that item (and it will not expand any item at all cause it executes click on button which is normal). And i have to click only on '+' icon or on white space where the button has ended already. 
If i try to use instead of button a textblock then everything works fine and it expands by clicking on the element itself, but textblock doesnt support commanding so i cannot execute my command with it. And RadTreeVireItem also doesnt support commanding. And i cannot specify something in codebehind cause I dont have one. Do u probably know some approach how I can resolve that.
Thanks for help!!!!

0
Miro Miroslavov
Telerik team
answered on 15 Jun 2010, 11:44 AM
Hi Kirill Kalinkin,

The problem is that the Button handles the MouseDown event, so the RadTreeViewItem does not receive it, causing the item not to expand. What you can do is to set IsHitTestVisible="False" to those buttons that don't have attached command. This way the buttons will pass the MouseDown event to the TreeViewItem.
Hope this will helps you.

Kind regards,
Miro Miroslavov
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.
Tags
TreeView
Asked by
Kirill Kalinkin
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Kirill Kalinkin
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Share this question
or