ContextMenu for TelerikControls

0 Answers 105 Views
NumericUpDown
alex
Top achievements
Rank 2
Bronze
Iron
Iron
alex asked on 29 May 2023, 05:07 PM | edited on 29 May 2023, 05:10 PM

Hello, I have an issue with the style of the ContextMenus.

I changed the style of the ContextMenu and it is working for TextBlock and TextBox but on Telerik controls like RadNumericUpDown and RadRichTextBox the context menu looks different.

Let's take for example the menu in the RadNumericUpDown (see attached picture).

I expect that the menu with Cut,Copy,Paste looks like other menus.

I tried to define in RadNumericUpDown.Resources a style for ContextMenu and RadContextMenu (change the Background property) but it doesn't work.

When I change the Foreground property of the TextBlock style inside RadNumericUpDown.Resources, I can see that the text color changed.

I hope you can guide me on this matter.

Thanks,

Alex

Martin Ivanov
Telerik team
commented on 01 Jun 2023, 11:11 AM

Can you post some code showing how you style the context menu of RadNumericUpDown?

About the RadRichTextBox, I will guess the context menu there is a bit more special, so I will recommend you to post your query in the RadRichTextBox for WPF area of the forum or via the support ticketing system.

alex
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 02 Jun 2023, 03:58 PM | edited

I fixed the style for the NumericUpDown. We made a TextBox style to set the MaxLength to 8 digits, but we forgot to make it BasedOn TextBox.

Anyway, can you explain what is the control type for the menu? All changes I made on the ContextMenu style didn't affect the menu.

Martin Ivanov
Telerik team
commented on 05 Jun 2023, 03:32 PM

This context menu is not part of Telerik UI for WPF. It is a menu that is built-in into WPF native TextBox and it is called EditorContextMenu. The EditorContextMenu is private so you can't access it, but you can replace it with your own context menu instance (or RadContextMenu).
alex
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 05 Jun 2023, 08:01 PM | edited

Thank you Martin,

How can I replace it with RadContextMenu and provide same functionality. Can I set the style if is private?

I can't just add a Context Menu because clicking on the control border will open my custom menu but while clicking in the center it will open the EditorContextMenu.

Martin Ivanov
Telerik team
commented on 08 Jun 2023, 10:31 AM

I have attached a small example how to remove the default ContextMenu and replace it with RadContextMenu. I hope that helps.
alex
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 15 Jun 2023, 06:54 PM

Thank you Martin. I will test it.

No answers yet. Maybe you can help?

Tags
NumericUpDown
Asked by
alex
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or