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

Remove readonlyrange() in richtextbox.

4 Answers 81 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
muhammad
Top achievements
Rank 1
muhammad asked on 18 Jul 2012, 04:55 PM
Hi,
     I am trying to remove the readonlyrange in richtextbox. I have selection for that but the method provided in WPF requires a readonly field ReadonlyRangeStart. How can I get this field from selection. or is there any other way to deal with this problem thanks.


In richtextbox I have selection of single word or paragraph. and need to extract readonlyrangestart field for method editor.document.deletereadonlyrange(readonlyrangestart);.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 19 Jul 2012, 12:39 PM
Hello Muhammad,

Please find attached a demo application which has implementation of deletion of read only ranges and making them editable. Please, look through it and let us know if you have any additional questions.

Kind regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
muhammad
Top achievements
Rank 1
answered on 20 Jul 2012, 10:22 AM
Hi Iva  ,
            I have tried in this way as well but it does not works. Actually I am trying to remove readonlyrange from document instead of documentEditor. and while doing so its throwing an exception. Moreover for a block its treating every thing a inlinebox like [2,011] are coming as five 5 boxes 1 for start block annotation 2nd for 2 third for , 4th for 011 and 5th for endblock annotation. where as its a single selection.
0
Iva Toteva
Telerik team
answered on 24 Jul 2012, 08:26 AM
Hello Muhammad,

The document is split into paragraphs and spans according to the formatting applied. However, each Span is presented by one or more SpanLayoutBoxes according to the content.
In your example, if you have [2,011], where "[" and "]" are the ReadOnlyRangeStart and End, respectively, you will have the following document structure in terms of layout boxes: 
  1. "[" - AnnotationMarkerLayoutBox;
  2. "2" - SpanLayoutBox
  3. "," - SpanLayoutBox
  4. "011" - SpanLayoutBox 
  5. "]" - AnnotationMarkerLayoutBox.

Please, provide some more details on your implementation and the exception you have encountered, as everything works correctly on our end, as you can see in the demo previously attached. In addition, we would appreciate it if you could attach your project in a support ticket and comment on why you wish to use the API of the document and not RadRichTextBox.


Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
muhammad
Top achievements
Rank 1
answered on 24 Jul 2012, 09:50 AM
Iva,
     Thanks for reply. The issue has been resolved. I was actually trying to convert readonly inlineboxes in different thread. Which is working now.

Regards.
Tags
RichTextBox
Asked by
muhammad
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
muhammad
Top achievements
Rank 1
Share this question
or