Disabling selection / readonly

2 posts, 0 answers
  1. ITLackey
    ITLackey avatar
    9 posts
    Member since:
    Jan 2011

    Posted 08 May 2013 Link to this post

    I am having an issue when I set the richtextbox IsReadOnly to true and even with IsSelectionEnabled set to false I am still able to drag elements around inside of the textbox. Is there anyway to prevent this from happening? I simply want a way to view html content without the user being able to manipulate any of the content.

    Any help is appreciated.

    Thanks!
    Ian
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 09 May 2013 Link to this post

    Hi Ian,

    As far as we are aware, when IsReadOnly is set to true and IsSelectionEnabled - to false, the only elements that can be moved are tables when selected with the table adorner. 

    You can work around this by removing the UI layer responsible for table movement like this:
    public MainPage()
    {
        InitializeComponent();
        this.editor.UILayersBuilder = new MyCustomUILayerBuilder();
    }
        
    class MyCustomUILayerBuilder : UILayersBuilder
    {
        protected override void BuildUILayersOverride(IUILayerContainer uiLayerContainer)
        {
            base.BuildUILayersOverride(uiLayerContainer);
            uiLayerContainer.UILayers.Remove(DefaultUILayers.TableMovementLayer);
        }
    }

    I hope this helps! If you are observing different results on your end or are having other difficulties, please let us know.
     
    Regards,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top