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

how do i show Table Editing menu items in default context menu

3 Answers 56 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Zhang
Top achievements
Rank 1
Zhang asked on 12 Dec 2013, 02:19 AM
I can only see Text Editing commands and Clipboard commands in the default context menu, and i don't want to customize another context menu, is there any possibility that i can show Table Editing commands by just setting somethings.

3 Answers, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 14 Dec 2013, 03:24 PM
Hello,

You can achieve the desired result by creating a custom content builder for the context menu and modifying the Construct method. By default, the table-related items are added to the menu when the current caret position is in a table, so all you have to do is add them when the caret is not in a table too:
public override ContextMenuGroupCollection Construct()
{
    ContextMenuGroupCollection contextMenuGroupCollection = base.Construct();
 
    if (!this.RadRichTextBox.Document.CaretPosition.IsPositionInsideTable)
    {
        contextMenuGroupCollection.Add(this.CreateTableCommands());
    }
 
    return contextMenuGroupCollection;
}

Note that though the items will be visible, the commands will be disabled unless in the context of table. 

I hope this helps!

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Zhang
Top achievements
Rank 1
answered on 17 Dec 2013, 04:51 AM
Yes, it works, but what i really need is a menu item of inserting a table, anyway, i've make it through writing codes in ContextMenu.Showing Event. Thanks
0
Petya
Telerik team
answered on 17 Dec 2013, 04:54 PM
Hello,

I am happy to hear you were able to implement the desired scenario. Let me know if you need any further assistance.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Zhang
Top achievements
Rank 1
Answers by
Petya
Telerik team
Zhang
Top achievements
Rank 1
Share this question
or