[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Paragraphs
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Lists
      Shapes
      Text Boxes
      Comments
      Checkboxes
      Document Properties
     Measure Units
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Hyphenation
    AutoCorrect
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Expand]Examples
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Comments

The RichEditControl allows you to add comments to documents. You can add, edit, and remove comments in code and from the UI.

Expanded Create a Comment

Use the following API to attach a comment to a document range:

Member Description
Paragraph.Range Retrieves the paragraph's range.
SubDocument.FindAll Finds all document ranges that contain the expression or text string.
SubDocument.Comments Provides access to the document's Comment collection.
CommentCollection.Create Creates a new item in the CommentCollection.

The code snippet belows creates an empty comment associated with the following phrase: "an extensive problem in hardware and architecture is the construction of the emulation of checksums".

Note

A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988.

Create a Nested Comment

The code snippet below demonstrates how to create a nested comment. To do that, pass the parent content as the CommentCollection.Create method's parameter.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988.

Expanded Edit the Comment

Edit the Comment Content

Use the API from the table below to edit the comment's content.

Member Description
Comment.BeginUpdate Opens the comment for modification.
SubDocument.InsertText Inserts a text string into the specified position.
TableCollection.Create Inserts a table into the specified position.
ShapeCollection.InsertPicture Inserts a floating picture into the specified position.
DocumentImageCollection.Insert Inserts an inline image into the specified position.
ShapeCollection.InsertTextBox Inserts a text box into the specified position.
Comment.EndUpdate Finalizes the comment update.

The following code sample adds text to the empty comment:

Note

A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988.

Edit the Comment Attributes

Use the following members to change the comment parameters (author, date, etc.):

Member Description
Comment.BeginUpdate Opens the comment for editing.
Comment.Author Specifies the comment's author.
Comment.Date Specifies the comment's last modified date.
Comment.Name Specifies the comment name.
Comment.EndUpdate Finalizes the comment update.

The code snippet below changes the comment's name, date and author.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988.

The image below demonstrates the result of the code execution.

Delete the Comment

To remove a comment from the document, use the CommentCollection.Remove method as shown in the code snippet below.

Expanded Comments in the User Interface

Users can use the Review Ribbon tab to insert, modify or remove comments. Refer to the Lesson 5 - Create Separate Ribbon Pages for a Rich Text Editor topic for more information on how to add the ribbon menu to the application.

The Comment group on the Review tab allows users to insert new comments, remove existing comments and navigate through all the comments in the document.

The Tracking group buttons allow users to highlight comments in the document, to filter them by the author, and specify whether to display comments in the document margins or Reviewing Pane.

To provide the application with the Reviewing Pane, set the RichEditControl.ShowReviewingPane property to true in XAML.

Display Options

The comments are displayed in the Reviewing Pane or in balloons that appear in the document margins. The related ranges are highlighted by a different color for each reviewer.

Use the DXRichEditCommentOptions (see DXRichEditCommentOptions) 's class properties to change the comment displaying options, such as range highlighting color or comment visibility.

Tip

Set the RichEditControl's DocumentCapabilitiesOptions.Comments property to Disabled to disable comments.

Is this topic helpful?​​​​​​​