how to change font color of hovered element

4 posts, 0 answers
  1. Kirill Kalinkin
    Kirill Kalinkin avatar
    4 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2010 Link to this post

    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!

  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 10 Jun 2010 Link to this post

    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.
  3. Kirill Kalinkin
    Kirill Kalinkin avatar
    4 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2010 Link to this post

    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!!!!

  4. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 15 Jun 2010 Link to this post

    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.
Back to Top