How to determine if current position is in editable range

3 posts, 1 answers
  1. Chris
    Chris avatar
    8 posts
    Member since:
    Apr 2014

    Posted 25 Aug 2014 Link to this post

    How can I determine if the current caret position in a RadRichTextBox is within a range that is editable?

  2. Answer
    Petya avatar
    973 posts

    Posted 28 Aug 2014 Link to this post

    Hi Chris,

    That depends on the approach you are using to restrict editing in your document. For example, if you are using the Document Protection feature and protection is enforced over the current document, here is how you can obtain the range where the caret is located and determine if the current user has rights to edit:
    var range = this.radRichTextBox.Document.GetContainingAnnotationRanges<PermissionRangeStart>(this.radRichTextBox.Document.CaretPosition.GetCurrentInline()).First();
     if (range != null)
         bool canEdit = this.radRichTextBox.ProtectionAuthenticationProvider.CanEdit(range.Info);

    I hope this is useful.

    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.
  3. DevCraft banner
  4. Chris
    Chris avatar
    8 posts
    Member since:
    Apr 2014

    Posted 28 Aug 2014 in reply to Petya Link to this post

    Thank you. That gives me the information I need.
Back to Top