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

How can I disable options from the context menu of a table?

1 Answer 188 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
TiborG
Top achievements
Rank 1
TiborG asked on 02 Mar 2015, 12:45 PM
When right clicking on a table inside the RichTextBox, a context menu appears. How can I remove/disable from this context menu the following options:
merge cells, table boders, autofit, table properties.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 02 Mar 2015, 04:08 PM
Hi Radu,

RadRichTextBox's API allows customizing the context menu by subscribing to the Showing event of ContextMenu and iterating through the groups you want to remove:
void contextMenu_Showing(object sender, Telerik.Windows.Controls.RichTextBoxUI.Menus.ContextMenuEventArgs e)
{
    IEnumerable<ContextMenuGroup> groupToRemove = e.ContextMenuGroupCollection
            .Where(contextMenuGroup => contextMenuGroup.Type == ContextMenuGroupType.TableCommands).ToList();
 
    foreach (var contextMenuGroup in groupToRemove)
    {
        e.ContextMenuGroupCollection.Remove(contextMenuGroup);
    }
}

Your other option is to create a custom context menu builder as explained in this help article.

Let me know if you have any other questions.

Regards,
Tanya
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.

 
Tags
RichTextBox
Asked by
TiborG
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or