Selection inside ReadOnlyRange

5 posts, 0 answers
  1. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 30 Jul 2012 Link to this post

    Hi

    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
  2. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 30 Jul 2012 Link to this post

    Should try harder before posting...

    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; }
    }

  3. UI for WPF is Visual Studio 2017 Ready
  4. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 31 Jul 2012 Link to this post

    Hi Charles,

    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.

    Regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 08 Aug 2012 Link to this post

    Hi Iva



    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!        
  6. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 13 Aug 2012 Link to this post

    Hi Charles,

    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.

    Greetings,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready