RadRichTextBox Move and Delete FloatingUIContainer

5 posts, 0 answers
  1. Marcílio
    Marcílio avatar
    5 posts
    Member since:
    Apr 2016

    Posted 14 May Link to this post

    I'm really need help with this issue.

     

    I'm successfully create a custom control and inserted on the RadRichTextBox using the FloatingUIContainer.But now I have tried everything to create a option capable to remove the custom control from the document. But nothing works and I do not have any error or any kind of feedback. The last test was follow below:

    radRichTextBox.Document.CaretPosition.MoveToStartOfDocumentElement(FloatingUiElement);
    radRichTextBox.Delete(false);

     

    Nothing happen when I'm used this command.

    I'm need to move the FloatingUIContainer on the page too. But once the element is on the page, I can't move them anymore. Even changing the container horizontal position. Once the scrolling of the document is activated the element returns to the original position.

    Somebody can help me?

  2. Boby
    Admin
    Boby avatar
    690 posts

    Posted 17 May Link to this post

    Hi Marcílio,

    I just tested the scenarios and I was not able reproduce any of the issues:
    For example, when a floating UI is present in the document, invoking 
    var firstBlock = radRichTextBox.Document.EnumerateChildrenOfType<FloatingUIContainer>().First();
     
    radRichTextBox.Document.CaretPosition.MoveToStartOfDocumentElement(firstBlock);
    radRichTextBox.Delete(false);
    successfully removes the block.

    Could you send us sample applications reproducing the issues, accompanied by specific steps to reproduce them? Specifically for the second issue, how are you trying to move the block, by code or through the UI? What is inside the block and does it handle user events in any way? 

    Regards,
    Boby
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Marcílio
    Marcílio avatar
    5 posts
    Member since:
    Apr 2016

    Posted 17 May in reply to Boby Link to this post

    Hi Boby,

    Thanks for the response. I have found the solution myself. Strangely was happening the following issue: Really when I remove the FloatingUIContainer using the mentioned method, my custom control created an inserted inside the FloatingUIContainer was not removed. The floating block disappear from the document but my custom control continue visible inside it. But I have created an event able to remove my control when this happen anyway.

    But taking advantage of your response, now I facing another issue... My objective is create a kind of floating text frame (Like Microsoft Word). And, so far, its working. I was able to insert the floating block, move it over the text (using mouse user interactivity), use adorners to resize de block, etc. But, when I use some keyboard events like delete, backspace, arrows, home key (and some others)... my text frame loses focus and the caret back to the main document. How could I avoid this behavior when my text frame is on focus inside the RadRichTextBox document? Is that possible?

    Thank you so much for the help.

    Best Regards.

  4. Boby
    Admin
    Boby avatar
    690 posts

    Posted 22 May Link to this post

    Hi Marcílio,

    You can use PreviewEditorKeyDown to cancel the default keyboard bindings in some cases, for example:
    this.radRichTextBox.PreviewEditorKeyDown += (sender, e) =>
    {
        if (!this.radRichTextBox.IsKeyboardFocused)
        {
            e.SuppressDefaultAction = true;
        }
    };

    Another option is to remove the default key bindings for the RadRichTextBox instance, but this would disable the keyboard shortcuts. You can read more for both approaches in the Keyboard Support help article.

    Regards,
    Boby
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Marcílio
    Marcílio avatar
    5 posts
    Member since:
    Apr 2016

    Posted 22 May in reply to Boby Link to this post

    Hi Boby.

    You saved my life. Works perfectly!!
    Thanks

Back to Top