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?
4 Answers, 1 is accepted
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.
the Telerik team
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
That's exactely what in your demo app: "Structured Content Editing" happens.
So this one is also marked as solved.
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,
the Telerik team