Completed
Last Updated: 22 Mar 2022 13:50 by ADMIN
Release R2 2022 (LIB 2022.1.322)
Luca
Created on: 24 Feb 2022 05:42
Category: SyntaxEditor
Type: Bug Report
0
RadSyntaxEditor: Disable Replace Function in RadSyntaxEditor when it is read-only

Setting the SyntaxEditorElement.IsReadOnly property to true disables editing the text inside RadSyntaxEditor. However, when opening the Find and Replace dialog, the user is still allowed to replace the text and thus change the content in the document. This shouldn't be allowed when the control is in read-only mode.

Workaround:

            this.radSyntaxEditor1.SyntaxEditorElement.InputHandler = new MyInputBehavior(this.radSyntaxEditor1.SyntaxEditorElement);

        public class MyInputBehavior : SyntaxEditorInputBehavior
        {
            public MyInputBehavior(RadSyntaxEditorElement editor) : base(editor)
            {
                
            }

            protected override void PerformOpenFileDialog(KeyEventArgs e)
            {
                this.SyntaxEditor.SearchPanel.ReplaceAllButton.Enabled = false;
                this.SyntaxEditor.SearchPanel.ReplaceButton.Enabled = false;
                this.SyntaxEditor.SearchPanel.ReplaceTextBox.Enabled = false;
                base.PerformOpenFileDialog(e);
            }
        }

0 comments