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

Undestroyable Readonly Ranges

4 Answers 79 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Christoph
Top achievements
Rank 1
Christoph asked on 22 Feb 2012, 03:28 PM
Hi

How can I protect a ReadOnly Ranges from being removed via the UI?
It's impossible to remove something inside the range itself
via the UI - that's nice.
But when for example selecting the whole document's content (Ctrl+A)
and removing it (DEL) the readonly ranges are also removed.
Generally anytime when the ROR is contained inside a selection and the
edges of the selection aren't part of the ROR, it can be removed.

Is there a way to supress it?
Can I protect parts of a document against editing/removal?


Greetings,
Chris

4 Answers, 1 is accepted

Sort by
0
Accepted
Iva Toteva
Telerik team
answered on 22 Feb 2012, 05:01 PM
Hello Chris,

The designed behavior is that it must not be possible to remove a part of the document contained in a ReadOnlyRange. When part of a ReadOnlyRange or the whole of it is contained within selection, all commands that apply changes to selection should be disabled.
I tried deleting ReadOnlyRanges from the document using the delete and backspace keys, but was not able to reproduce the behavior you have described. Please find attached the demo I used for testing.
We would appreciate it if you could elaborate more on the steps to reproduce the improper behavior (using the demo attached) or attach a demo of yours.

Regards,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Christoph
Top achievements
Rank 1
answered on 22 Feb 2012, 05:37 PM
Hi Iva

Thanks very much for the quick response
and the demo code.
Probably my initial post was kind of funny.
I thought I had experienced this behaviour some days ago.
Trying to repro it now - I noticed I kind of mixed it up with another issue.
You're absolutely right: A ReadOnly range actually is readonly and is
not removable by userinteraction.
Thanks a lot for pointing it out and sorry for the false alert.

The thing I mixed it up with is that I want undestroyable bookmarks
where the space between Start and End is editable.
The bookmark's content may be empty and may be deleted
but the bookmark itself (i.e the BookmarkRangeStart and BookmarkRangeEnd tags in XAML)
shall not be removable itself (also possibly not movable, but kind of fixed or anchored
inside the document structure)

Maybe I could better solve it with some kind of field.
I am not into deep the document model yet.
The scenario is that I have some areas in the
document where the user has to enter and format
text - also optionally insert images or other media
(It's is not something filled in by a data provider so I don't think
a merge field is what i am looking for)
These areas always have a title that is preformatted and uneditable
- that's where  I use the readonly ranges.

The whole document consists of these pairs of readonly titles and
editable ranges below.
What would you think is the best coding object / container for the
editable area?

Thanks again,
Chris





0
Christoph
Top achievements
Rank 1
answered on 23 Feb 2012, 01:03 PM
As for the last point: allow modifications only in limited regions of the document -
That's exactely what in your demo app: "Structured Content Editing" happens.
So this one is also marked as solved.
0
Iva Toteva
Telerik team
answered on 27 Feb 2012, 06:46 PM
Hello Chris,

We are glad to hear that you have found the answer to your question. We are working on the documentation about the custom ranges and all elements additional elements used in the demo, but if you have any questions in the meantime, do not hesitate to contact us again.

Kind regards,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
RichTextBox
Asked by
Christoph
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Christoph
Top achievements
Rank 1
Share this question
or