Disable rotating of images

6 posts, 0 answers
  1. Kirk Quinbar
    Kirk Quinbar avatar
    48 posts
    Member since:
    Nov 2007

    Posted 04 Jan 2012 Link to this post

    Is there anyway to completely disable rotating of images, or for that matter anything else that would not be supported in html? we are using the richtextbox as an html editor to make nice email templates for our product and dont want the users to be able to do functions that arent available in html.
  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 06 Jan 2012 Link to this post

    Hi Kirk,

    Thank you for the feedback. We understand the case and you point makes a lot of sense. However currently we do not have option to turn off all HTML unfriendly features. I will add an item in our to-do list for consideration.

    One way to solve this specific issue related to rotation of images is to create a custom UI layer builder and remove the AdornerLayer which contains the borders for rotate. The following demo: http://demos.telerik.com/silverlight/#RichTextBox/CustomizePresentation

    shows how to make custom UI layers. You need only custom layer builder where you can remove the mentioned layer:

    uiLayerContainer.UILayers.Remove(DefaultUILayers.AdornerLayer);

    However this would not enough as when selecting a image a Mini toolbar appears, that allows the users to rotate the image.
    You need to set the property IsImageMiniToolBarEnabled of the RichTextBox to False in order to disable it.

    Disabling this features would also have impact on some other features you might actually need thus we leave to your consideration whether this solution is appropriate for you.

    Let us know if we can help further.

    All the best,
    Martin
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Kirk Quinbar
    Kirk Quinbar avatar
    48 posts
    Member since:
    Nov 2007

    Posted 06 Jan 2012 Link to this post

    would removing that adornerlayer also remove the ability to resize the picture, or is there someway to only remove the rotating part?

    Kirk
  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 09 Jan 2012 Link to this post

    Hi Kirk,

    Unfortunately currently there is no way to disable only this specific feature of the layer to rotate the image. However, you can remove the whole layer and add another layer which includes only the logic for resizing the image.
    You can download the source code and see how ImageAdornerUI has been implemented, strip the logic for rotating the image and plug the new UI layer as described in this article.
    If you need further assistance, do not hesitate to contact us again.

    Kind regards,
    Martin
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Brian Peacock
    Brian Peacock avatar
    2 posts
    Member since:
    Mar 2010

    Posted 12 Apr 2012 Link to this post

    Hi,

    Is it possible that you could provide a working example of the rotate switched off?

    I have basically copied the source from the ImageAdornerUI, followed the implementation from the DocumentPagePresenter class, have inlcuded a copy of the SelectionUILayer, and yet I'm still not getting the box up on the screen.

    If I perform a RegisterInlineSelectionHandler to an object of Nothing (for Image and floating image), then I can see a blue filled box over the actual image (using windows7theme).

    As soon as I Register to the copy of ImageAdornerUI then I do not see anything at all - it's as if it is hidden, or the layer is not showing correctly?

    Have I done something wrong, can you provide me with any clues?

    Cheers
    Brian


    Protected Overrides Sub BuildUILayersOverride(uiLayerContainer As Telerik.Windows.Documents.UI.IUILayerContainer)
        Dim tmpImg As ImageAdornerUI = Activator.CreateInstance(Of ImageAdornerUI)()
        AddHandler tmpImg.ImageResized, AddressOf adornerUI_ImageResized
        AddHandler tmpImg.ImageRotated, AddressOf adornerUI_ImageRotated
        AddHandler tmpImg.BlockMoved, AddressOf adornerUI_BlockMoved
        tmpImg.HideSelection()
     
        Dim adornerLayer As UIElementsLayer = uiLayerContainer.UILayers.GetLayerByName(DefaultUILayers.AdornerLayer)
     
        If Not IsNothing(adornerLayer) Then
            adornerLayer.AddChild(tmpImg)
        End If
     
        Dim selLayer As New mySelectionUILayer(uiLayerContainer.Owner)
        If Not IsNothing(selLayer) Then
            selLayer.RegisterInlineSelectionHandler(GetType(Telerik.Windows.Documents.Model.ImageInline), tmpImg)
            selLayer.RegisterInlineSelectionHandler(GetType(Telerik.Windows.Documents.Model.FloatingImageBlock), tmpImg)
        End If
     
        Dim x As New List(Of IUILayer)
        For Each layer In uiLayerContainer.UILayers
            If layer.Name = DefaultUILayers.SelectionLayer Then
                x.Add(selLayer)
            ElseIf layer.Name = DefaultUILayers.AdornerLayer Then
                x.Add(adornerLayer)
            Else
                x.Add(layer)
            End If
     
        Next
     
        uiLayerContainer.UILayers.Clear()
     
        For Each layer In x
            uiLayerContainer.UILayers.AddLast(layer)
        Next
  7. Vesko
    Admin
    Vesko avatar
    45 posts

    Posted 16 Apr 2012 Link to this post

    Hello Brian,

    As the solution below does not seem very easy to be implemented, we have decided to provide an out of the box setting for enabling/disabling the features of ImageAdornerUI. We will do our best to provide it in some of the upcoming LIBs (Latest Internal Builds) and it also will be included in our next major release Q2.
    Hope this helps!

    Regards,
    Vesko
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
DevCraft banner