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

4 posts, 1 answers
  1. Zhang
    Zhang avatar
    13 posts
    Member since:
    Oct 2013

    Posted 11 Dec 2013 Link to this post

    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.
  2. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 14 Dec 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Zhang
    Zhang avatar
    13 posts
    Member since:
    Oct 2013

    Posted 16 Dec 2013 Link to this post

    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
  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 17 Dec 2013 Link to this post

    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 >>
Back to Top