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

Change color when menu item is highlighted

2 Answers 454 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Vadimir
Top achievements
Rank 1
Vadimir asked on 02 Mar 2015, 02:59 PM
Hi,
My Telerik control version is 2014.3.1202.40 and I'm using the Expression Dark theme.
I'd like to modify the color of menu item and it background when the menu item is highlighted (i.e. when the mouse is over). For example, in the attached screen dump, I'd like to set "Copy" to red, and its background to green. I try to find the colors in Telerik.Windows.Controls.Navigation.xaml, but don't know which item to change. Could you help me with that? Thanks.

Regards,
Gong

2 Answers, 1 is accepted

Sort by
0
Accepted
Masha
Telerik team
answered on 03 Mar 2015, 08:02 AM
Hello Gong,

You need to modify the ControlTemplate of RadMenuItemStyle in order to modify the default highlight style of menu items. To change the foreground color of RadMenuItems you need to updated the VisualState named "Highlighted". Please check the code snippet below:

<VisualState x:Name="Highlighted">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground)">
            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource MenuForeground_MouseOver}"/>
        </ObjectAnimationUsingKeyFrames>

To change the Background color of highlighted items look for Rectangle named HighlightVisual and update its Fill value.


I've attached a sample project which demonstrates the above approach.

I hope it helps.

Regards,
Masha
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vadimir
Top achievements
Rank 1
answered on 03 Mar 2015, 10:26 AM
Thanks, Masha. It works.
Tags
Menu
Asked by
Vadimir
Top achievements
Rank 1
Answers by
Masha
Telerik team
Vadimir
Top achievements
Rank 1
Share this question
or