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

Customizing Selection Behaviour

1 Answer 91 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 26 Sep 2016, 01:08 PM

Is there a way to customize how selection works in the RadRichTextBox. We have an application where we would like to restrict certain AnnotationRanges from being selected. I am aware of the IsCopyable property on annotation ranges, but I am specifically looking for the ability to restrict selection as opposed to restricting copying. 

In addition to this, we make use of tables and when selecting the contents of a cell we would like to be able to restrict the selection to the cell contents and not allow the cell itself, the table row, or the table to be selected.

Is there any functionality that allows us to override this behaviour or see what selection is about to be made and change it before it is made?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 28 Sep 2016, 09:55 AM
Hello Chris,

You could modify the annotation's behavior by its properties - SkipPositionsInRange, IsRangeDeletable, IsRangeEditable and etc. More information about annotations you could read in this help article and you could check the Custom Annotations for further information about how they could be customized. However, this wouldn't change the selection UI behavior (whether a selection shall be drawn over such elements), since there isn't an out-of-the-box way to achieve this. 

To restrict the operations within the Table (copying, deleting, editing), you could insert it between such a range. For example, the Table could be inside a ReadOnlyRange or between other custom annotation ranges which disable the editing or copying of that Table.

The RadRichTextBox supports programmatic selection in addition to the one via the UI. You could read the Selection help article for further information on that matter.

In addition, can you share with us what is the exact scenario you are trying to achieve by restricting the selection of document elements? What you are trying to prevent in this way - to edit their content, to delete them or just not to render a UI over it them?

Regards,
Todor
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
Chris
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or