At the moment, it isn't possible to click inside a ReadOnlyRange - it is only possible to select it if the selection begins and ends before and after the range.
Ideally I would like to be able to place the cursor inside a ReadOnlyRange and select any part of it, just as I would a non-ReadOnlyRange. The only difference being that deletion would not be possible.
Is there any workaround or sub-classing of ReadOnlyRange that would make this possible?
Thanks
Charlie
4 Answers, 1 is accepted
I created a new annotation range derived from ReadOnlyRangeStart (and ReadOnlyRangeEnd) with a property overridden as below. This gives me what I wanted - I assume there's no issue with doing this?
public
override
bool
SkipPositionsInRange
{
get
{
return
false
; }
}
You can create and use custom annotation ranges by inheriting from AnnotationRangeStart and AnnotationRangeEnd or any of the already implemented annotation range elements (FieldRangeStart/End, ReadOnlyRangeStart/End, etc). More information on the properties that can be overridden can be found here.
If you need additional assistance, do not hesitate to contact us again.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I have have another issue - I'm not sure if there's a solution!
What I'd like is a range that is read-only - i.e. the user cannot delete or change the text content within - but I would like them to be able to change the font and styling.
Currently it appears to be one or the other - I can achieve both. The only conceivable workaround I can think of is replacing most of the styling commands that the ribbon is bound to with my own that allow execution on read-only ranges. But that sounds like quite a large task!
You are right - this behavior cannot be that easily achieved. The logic that disables changes to the document when the selection contains read only elements lies quite deep in the code. Unfortunately you will not be able to apply formatting to the read-only parts of the document using the public API.
We will log this as a feature request, but it is not clear when it will be implemented.
The only way to achieve the desired behavior with the current version is to download the source of the control and change the way the commands are executed in read-only parts of the document.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.