[Question]cusotmize in comment layout

15 posts, 0 answers
  1. Hamed
    Hamed avatar
    3 posts
    Member since:
    Feb 2013

    Posted 19 Apr 2013 Link to this post

    Hi every one

    in RichTextBox control it offers that i can add new comment for selected test by InsertCommentCommand function
    how can i custom this comment by adding a custom user control instead of text control that i put my comment inside it?

    thanks every one.
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 24 Apr 2013 Link to this post

    Hi,

    The content of the comments is actually a RadDocument and it is visualized by a RadRichTextBox instance that is shown in the comment balloon. Inserting user controls instead of comments is not a scenario we currently support.

    Greetings,
    Alex
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 14 Oct 2014 in reply to Alex Link to this post

    Hi Alex,
        We are using RadRichTextBox (for WPF). Could you please help on below issue :

    1) If we set myRadRichTextBox.LayoutMode = DocumentLayoutMode.Paged; then comment pane is displayed properly (and not getting collapsed).
    Please refer to the attachment "PagedLayout_CommentPane.png"

    2) If we set  myRadRichTextBox.LayoutMode = DocumentLayoutMode.Flow; then comment pane is getting collapsed.
    Please refer to the attachment "FlowLayout_CommentPane.png". Could you please help me to solve this, because currently for our Business Purpose, we are planning to have "Flow" Mode with comments. Thanks. Obuliraj R





  5. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 16 Oct 2014 Link to this post

    Hello Ramalingam,

     Thank you for contacting us.

    I can confirm that the problem exists and have opened bug report item in our feedback portal where you could upvote and track the overall progress of the issue.

    Regards,
    Mihail
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Ashish
    Ashish avatar
    1 posts
    Member since:
    Feb 2014

    Posted 10 Nov 2014 Link to this post

    Currently the comment balloon needs to be clicked before typing the text. Is it possible to add some default text (like user's full name) to the a comment balloon and display cursor next to inserted text programmatically on CommentShowing or some other event?  All we want is if a new comment is inserted and users start typing the text should be typed into comment balloon directly. Please help.
  7. Petya
    Admin
    Petya avatar
    975 posts

    Posted 13 Nov 2014 Link to this post

    Hello Ashish,

    You can insert content in a comment as soon as it is added to the document by subscribing to the CommandExecuted event. For example, obtain the comment and create a RadDocumentEditor for it like this:
    void radRichTextBox_CommandExecuted(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutedEventArgs e)
    {
        if (e.Command is InsertCommentCommand)
        {
            var commentEnd = this.radRichTextBox.Document.Selection.GetAnnotationMarkersOfType<CommentRangeEnd>().First();
            RadDocumentEditor editor = new RadDocumentEditor(commentEnd.Comment.Body);
     
            string username = "Anonymous";
            if (this.radRichTextBox.CurrentUser != null)
            {
                username = this.radRichTextBox.CurrentUser.Username;
            }
     
            editor.Insert(username + " at " + DateTime.Now);
        }
    }

    Focusing the comment is not possible at this point, although making this the default behavior is already in our backlog. You can track the status of the feature through this item in the public portal.

    Regards,
    Petya
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 11 Dec 2014 in reply to Petya Link to this post

    Hi Team,
    Could you please help us to achieve "Expected Result"

    Steps:
    1. Type Text  “Parent (Child) Comment” in the Editor
    2. Select  all text and insert new comment. Comment gets created.  
    3. Select only “Child” word from text “Parent (Child) Comment”  and insert new comment. Comment gets created.
    4. Select “Comment” Balloon for word “Child” to select it  (green thick line will appear)
    5. Click delete comment button
     
    Expected Result: 
    Since the comment balloon for word “Child” was selected in UI,  it should be deleted 

    Actual Result:
    The comment for  text “Parent (Child) Comment” gets deleted. Ideally selected comment should be deleted. This appears to be a problem when comments are nested. The delete comment deletes the incorrect comment.

    Please refer to the attachment "Delete Comment - Issue.png"

    Thanks,
    Obuliraj Ramalingam
  9. Svetoslav
    Admin
    Svetoslav avatar
    55 posts

    Posted 15 Dec 2014 Link to this post

    Hello Ramalingam,

    Thank you for contacting us.

    I managed to reproduce the reported issue and logged it in our backlog. You can track its state from the following feedback item: Deleting nested comment annotations deletes the outer-most first.
    As a workaround I would suggest you to implement your own command, which calls the following methods to delete a comment:
    private void DeleteActiveComment()
    {
        Inline inline = GetInlineFromCaretPositionOrSelection(this.radRichTextBox.Document);
        var comment = this.radRichTextBox.Document.GetContainingAnnotationRanges<CommentRangeStart>(inline, true).LastOrDefault();
     
        if (comment != null)
        {
            this.radRichTextBox.DeleteComment(comment);
        }
    }
     
    public static Inline GetInlineFromCaretPositionOrSelection(RadDocument document)
    {
        InlineLayoutBox inlineBox = null;
        if (document.Selection.IsEmpty)
        {
            inlineBox = document.CaretPosition.GetCurrentInlineBox();
        }
        else
        {
            SelectionRange lastRange = document.Selection.Ranges.Last;
            if (lastRange.IsReversed)
            {
                inlineBox = lastRange.EndPosition.GetCurrentInlineBox();
            }
            else
            {
                inlineBox = lastRange.StartPosition.GetCurrentInlineBox();
            }
        }
     
        if (inlineBox != null)
        {
            return inlineBox.AssociatedInline;
        }
        else
        {
            return null;
        }
    }
    I have added some Telerik points to your account as a token of appreciation for the bug report.

    I hope this information is helpful. Let me know if you need further assistance.

    Regards,
    Svetoslav
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 16 Dec 2014 in reply to Svetoslav Link to this post

    Hi Svetoslav,
    Thanks for your time & sample code. I have tried this approach. Sorry, still there is an issue:

    1) If I select "parent" comment & delete it, it's deleting respective "parent" comment.
    2) If I select "child" comment & delete it, then it's deleting both "parent" and "child" comments.

    So, (1) is working like expected and (2) is not.
    Could you please try to duplicate this scenario & help us.

    Thanks,
    Obuliraj Ramalingam

  11. Todor
    Admin
    Todor avatar
    168 posts

    Posted 18 Dec 2014 Link to this post

    Hi Ramalingam,

    I was able to delete the comments in any desired order (from inner to outer and vice versa) by using the provided code-snippet in the previous post from Svetoslav. Please ensure you the custom command is not executed twice.

    For your convenience, I've created a sample demo project which illustrates the suggested approach. You can find it attached. It will be great if you modify the sent project in a way the issue can be reproduced and send it back to us. 

    Looking forward to your reply.

    Regards,
    Todor
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  12. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 23 Dec 2014 in reply to Todor Link to this post

    Hi Todor,
    Thanks for the sample code.
    Now it's working like expected.

    Thanks,
    Obuliraj Ramalingam
  13. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 29 Dec 2014 in reply to Ramalingam Link to this post

    Hi Team,
    Could you please clarify me on below scenario :

    Steps :

    1) Copied large text from Word document and pasting to RadRichTextBox.

    2) Selected particular word and clicked "Insert Comment" button

    3) New comment is inserted, however the focus is not staying in selected text nor (newly inserted) comment

    4) If I manually scroll to the selected text, then I am able to see the (newly inserted comment).

    5) For further selection, Insert comment is working fine

    Issue :
    Could you please suggest a way to solve issue in step 3)

    Trials from my side:
    I tried to call following methods, but they are not working

    myRadRichTextBox.UpdateLayout();
    myRadRichTextBox.UpdateEditorLayout();
    myRadRichTextBox.Focus();

    if (myRadRichTextBox.ActiveEditorPresenter != null)
    {
       myRadRichTextBox.ActiveEditorPresenter.RecreateUI();
    }

    Thanks,
    Obuliraj Ramalingam
  14. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 29 Dec 2014 in reply to Ramalingam Link to this post

    Please refer to the following attachments, for previous post
    "1 - Insert comment for first time.png"
    "2 - Scroll to particular text.png"
  15. Boby
    Admin
    Boby avatar
    595 posts

    Posted 30 Dec 2014 Link to this post

    Hello Ramalingam,
    I was not able to reproduce the described issue, nor with the sample application we sent you, nor with other simple application. On our side, the focus is property returned to the Main document body (as expected) where the newly inserted comment is automatically selected.

    I would suggest you to open separate support ticket, where you would be able to attach sample application reproducing the issue. This way we will be able to investigate the issue further.

    Regards,
    Boby
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. Ramalingam
    Ramalingam avatar
    21 posts
    Member since:
    Apr 2014

    Posted 31 Dec 2014 in reply to Boby Link to this post

    Hi Boby,
    I am able to fix this issue using following code segment.
    private void myRadRichTextBox_CommentShowing(object sender, CommentShowingEventArgs e)
    {
      if (e.Comment.Body.IsEmpty)
      {
        myRadRichTextBox.Document.GoToComment(e.Comment);
      }
    }

    private void myRadRichTextBox_CommandExecuted(object sender, CommandExecutedEventArgs e)
    {
      if (e.Command is InsertCommentCommand)
      {
        myRadRichTextBox.ActiveEditorPresenter.RecreateUI();
      }
    }

    Thanks,
    Obuliraj Ramalingam
Back to Top
UI for WPF is Visual Studio 2017 Ready