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

ContextMenu customize item highlight

2 Answers 311 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
gerardo
Top achievements
Rank 1
Veteran
gerardo asked on 06 Jul 2020, 07:54 AM
I am using contextmenu on my wpf project. I tried customize the items background on focus but I can't find a way to remove the yellow highlights color. Any idea on how I can override this property?

2 Answers, 1 is accepted

Sort by
0
Accepted
Vicky
Telerik team
answered on 08 Jul 2020, 02:48 PM

Hi gerardo,

To customize the items of the RadContextMenu, you will need to edit their default control template. Regarding the yellow highlights, which I assume come from the default Office Black theme, you need to look for the following two Border elements and modify their background and border colors up to your liking:

<Border x:Name="HighlightVisual"
		Grid.ColumnSpan="4"
		Opacity="0"
		CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
		BorderThickness="1"
		BorderBrush="{StaticResource ControlOuterBorder_Highlighted}"
		Background="{StaticResource ControlBackground_Highlighted}">
	<Border x:Name="HighlightInnerBorderVisual"
			BorderThickness="1"
			CornerRadius="{StaticResource SplitButton_SpanInnerCornerRadius}"
			BorderBrush="{StaticResource ControlInnerBorder_Highlighted}"/>
</Border>

The inner yellow background comes from the StaticResource ControlBackground_Highlighted.
Please, try out the above approach and let me know about the results.

Best Regards,
Vicky
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
gerardo
Top achievements
Rank 1
Veteran
answered on 12 Jul 2020, 06:16 AM
Thank you for the reply Vicky. This approach works and I am now able to customize the highlight color and behavior. Thank you.
Tags
ContextMenu
Asked by
gerardo
Top achievements
Rank 1
Veteran
Answers by
Vicky
Telerik team
gerardo
Top achievements
Rank 1
Veteran
Share this question
or