This is a migrated thread and some comments may be shown as answers.

Ctrl+Backsspace not working in RadRichtextbox

3 Answers 17 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
chad hartz
Top achievements
Rank 1
chad hartz asked on 05 Sep 2014, 10:48 AM
In silverlight richtextbox we have the option Ctrl+Backspace to delete the previous typed word.
But in Telerik Radrichtextbox, we don't have that option.
Can anyone please help me out of this.
Is there any option to add Ctrl+Backspace property?

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 08 Sep 2014, 11:47 AM
Hi Chad,

At this point this functionality is not available in RadRichTextBox. The feature is already in our product backlog and you can track the public item related to it in the Ideas & Feedback Portal: radrichtextbox ctrl backspace behavior.

In the meantime you could try implementing this yourself. The Keyboard Support article shows how you can register a custom keyboard binding or subscribe to the PreviewEditorKeyDown event of RadRichTextBox to customize the control's behavior.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Chad
Top achievements
Rank 1
answered on 08 Sep 2014, 03:21 PM
Hi Petya,
Can you please give an example of code ,in which RadRichtextbox is customised to have the Ctrl+Backspace property.
Which will be very helpful.

Thanks
0
Petya
Telerik team
answered on 09 Sep 2014, 08:54 AM
Hi Chad,

Here's a very simple implementation of this:
void radRichTextBox_PreviewEditorKeyDown(object sender, Telerik.Windows.Documents.PreviewEditorKeyEventArgs e)
{
    if ((Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) && Keyboard.IsKeyDown(Key.Back))
    {
        DocumentPosition end = new DocumentPosition((sender as RadRichTextBox).Document);
        DocumentPosition start = new DocumentPosition((sender as RadRichTextBox).Document);
 
        end.MoveToPosition((sender as RadRichTextBox).Document.CaretPosition);
        start.MoveToPosition(end);
        start.MoveToCurrentWordStart();
 
        (sender as RadRichTextBox).Document.Selection.SetSelectionStart(start);
        (sender as RadRichTextBox).Document.Selection.AddSelectionEnd(end);
 
        (sender as RadRichTextBox).Delete(false);
    }
}

Note that you need to take into account the case when the current caret position is in the beginning of a word and handle it. I.e. this would only work for the cases when the caret is at the green marker on the attached picture, but not at the red marker.

I hope this is useful.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
RichTextBox
Asked by
chad hartz
Top achievements
Rank 1
Answers by
Petya
Telerik team
Chad
Top achievements
Rank 1
Share this question
or