Approved
Last Updated: 26 Jun 2018 08:32 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 14 Jun 2018 10:21
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - InvalidOperationException when showing the context menu
To reproduce: run the Demo application >> RichTextEditor >> First Look example and follow the steps illustrated in the attached gif file. 

1. First add a footnote in the text
2. Than select a part of the footnote text or all text and use the context menu to cut the text
3. Then,  paste the text in the document, it doesn't matter were.
4. Next step is to remove the footnote reference.
5.Then, scroll through the document and press the right mouse button to open the context menu.

The object release should have been called and the context menu is disposed. If so the error occurs.

Workaround:

this.radRichTextEditor1.MouseClick += radRichTextEditor1_MouseClick;

        private void radRichTextEditor1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (this.radRichTextEditor1.RichTextBoxElement.ContextMenu != null)
                {
                    FieldInfo fi = typeof(Telerik.WinControls.RichTextEditor.UI.ContextMenu).GetField("radDropDownMenu", BindingFlags.Instance | BindingFlags.NonPublic);
                    RadDropDownMenu dropdown = fi.GetValue(this.radRichTextEditor1.RichTextBoxElement.ContextMenu) as RadDropDownMenu;
                    if (dropdown.IsDisposed)
                    {
                        this.radRichTextEditor1.RichTextBoxElement.ContextMenu = new Telerik.WinControls.RichTextEditor.UI.ContextMenu();
                    }
                }
            }
        }
Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments