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

Edit the default context menu?

4 Answers 152 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Nov 2010, 07:20 PM
I like the context menu that comes default with the radrichtext box, however, I would like to drop a few of the options.  Can I do that just by editing the Context menu, or do I need to write my own context menu?  If I need to write my own, how can I include the spell check functionality in my context menu?

Thanks,
Michael

4 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 19 Nov 2010, 12:28 PM
I have the same inquery.

I need to add extra custom elements to the contextMenu.  Like a new menuitem with sub elements.

if there a way to access this menu programatically ? thanks.

0
Boby
Telerik team
answered on 19 Nov 2010, 05:09 PM
Hello Joseph and Michael,
You can examine our blog post about customizing the RadRichTextBox's ContextMenu.

Please get back to us if you have other questions.

Regards,
Boby
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Keith
Top achievements
Rank 1
answered on 13 Jun 2011, 09:33 PM
This constantly referenced post does not show how to hide any of the items like Hyperlink..., Paragraph, etc. that appear in the ContextMenu.  Here is how I achieved this.

private void ContextMenu_Showing(object sender, ContextMenuEventArgs e)
        {
            // Get
            var groups = e.ContextMenuGroupCollection;

            // Remove Spelling... menu item if it is present
            if (groups[0].Last().Command is Telerik.Windows.Documents.RichTextBoxCommands.ShowSpellCheckingDialogCommand)
            {
                // Hide Spelling...
                groups[0].Last().Visibility = Visibility.Collapsed;
            }

            // Clear everything from the menu except for the Spelling and Cut/Copy/Paste
            for (int i = 1; i < e.ContextMenuGroupCollection.Count; i++)
            {
                groups[i].Clear();
            }
        }
0
Iva Toteva
Telerik team
answered on 16 Jun 2011, 12:00 PM
Hello Keith,

Thank you for sharing the approach you have adopted for customizing the context menu.
I personally find the approach with custom content menu builder neater, but both solutions produce the same effect in the end.
You can find some demos with custom context menus in this forum thread.

Kind regards,
Iva
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
RichTextBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Boby
Telerik team
Keith
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or