Customizing Selection Behaviour

2 posts, 0 answers
  1. Chris
    Chris avatar
    11 posts
    Member since:
    Apr 2014

    Posted 26 Sep 2016 Link to this post

    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?


  2. Todor
    Todor avatar
    168 posts

    Posted 28 Sep 2016 Link to this post

    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?

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top