Unplanned
Last Updated: 14 Nov 2022 07:39 by ADMIN
Todd
Created on: 14 Nov 2022 07:27
Category: RichTextEditor
Type: Feature Request
0
RadRichTextEditor: Add support for Ctrl+Backspace to delete the previous word and Ctrl+Delete the next word
Add support for DeletePreviousWord and DeleteNextWord commands, triggered with Ctrl+Backspace and Ctrl+Delete keyboard shortcuts.
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 14 Nov 2022 07:39

Hello, Todd,

Currently, it is possible to achieve this functionality by using a custom behavior:

        public RadForm1()
        {
            InitializeComponent();

            this.radRichTextEditor1.Text = "Once upon a time"; 

            radRichTextEditor1.InputHandler = new MyInputBehavior(radRichTextEditor1.RichTextBoxElement);
        }
        
        public class MyInputBehavior : Telerik.WinForms.RichTextEditor.RichTextEditorInputBehavior
        {
            public MyInputBehavior(RadRichTextBox editor) : base(editor)
            {
            }

            protected override void ProcessBackKey(KeyEventArgs e)
            {
                if (e.Control)
                {
                    DocumentPosition startPosition = this.RichTextBox.Document.CaretPosition; 
                    DocumentPosition endPosition = new DocumentPosition(startPosition);
                    startPosition.MoveToPreviousWordStart(); 
                    this.RichTextBox.Document.Selection.AddSelectionStart(startPosition);
                    this.RichTextBox.Document.Selection.AddSelectionEnd(endPosition);
                }
                base.ProcessBackKey(e);
            }
        }

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.