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

2 posts, 0 answers
  1. Radu
    Radu avatar
    34 posts
    Member since:
    Oct 2012

    Posted 02 Mar 2015 Link to this post

    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!
  2. Tanya
    Admin
    Tanya avatar
    403 posts

    Posted 02 Mar 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top