This is a migrated thread and some comments may be shown as answers.

[Question]cusotmize in comment layout

14 Answers 52 Views
This is a migrated thread and some comments may be shown as answers.
Hamed
Top achievements
Rank 1
Hamed asked on 19 Apr 2013, 07:21 PM
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.

14 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 24 Apr 2013, 11:17 AM
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.

0
Ramalingam
Top achievements
Rank 1
answered on 14 Oct 2014, 12:24 PM
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





0
Mihail
Telerik team
answered on 16 Oct 2014, 01:09 PM
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.

 
0
Ashish
Top achievements
Rank 1
answered on 10 Nov 2014, 10:52 PM
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.
0
Petya
Telerik team
answered on 13 Nov 2014, 02:45 PM
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.

 
0
Ramalingam
Top achievements
Rank 1
answered on 11 Dec 2014, 12:38 PM
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
0
Svetoslav
Telerik team
answered on 15 Dec 2014, 05:22 PM
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.

 
0
Ramalingam
Top achievements
Rank 1
answered on 16 Dec 2014, 12:14 PM
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

0
Todor
Telerik team
answered on 18 Dec 2014, 12:41 PM
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.

 
0
Ramalingam
Top achievements
Rank 1
answered on 23 Dec 2014, 08:25 AM
Hi Todor,
Thanks for the sample code.
Now it's working like expected.

Thanks,
Obuliraj Ramalingam
0
Ramalingam
Top achievements
Rank 1
answered on 29 Dec 2014, 08:55 AM
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
0
Ramalingam
Top achievements
Rank 1
answered on 29 Dec 2014, 08:59 AM
Please refer to the following attachments, for previous post
"1 - Insert comment for first time.png"
"2 - Scroll to particular text.png"
0
Boby
Telerik team
answered on 30 Dec 2014, 04:17 PM
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.

 
0
Ramalingam
Top achievements
Rank 1
answered on 31 Dec 2014, 11:27 AM
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
Asked by
Hamed
Top achievements
Rank 1
Answers by
Alex
Telerik team
Ramalingam
Top achievements
Rank 1
Mihail
Telerik team
Ashish
Top achievements
Rank 1
Petya
Telerik team
Svetoslav
Telerik team
Todor
Telerik team
Boby
Telerik team
Share this question
or