[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
   [Expand]RichEditControl Document
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    AutoCorrect
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Collapse]Examples
    [Expand]UI Customization
    [Expand]Files
    [Expand]Text
    [Expand]Formatting
    [Expand]Styles
    [Expand]Pictures
    [Expand]Text Boxes
    [Expand]Tables
    [Collapse]Document Elements
      How to: Insert Bookmark or Hyperlink
      How to: Create, Edit and Delete Comments
      How to: Specify Document Properties
      How to: Create and Modify Header
      How to: Create a Checkbox
    [Expand]Layout
    [Expand]Automation
     Spell Check
    [Expand]Export
    [Expand]Printing
    [Expand]Protection
    [Expand]Commands
    [Expand]Miscellaneous
  [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)

How to: Create, Edit and Delete Comments

The following example illustrates how to add, edit and delete comments in the current document.

All the document comments are contained in the collection represented by the CommentCollection interface. The collection can be accessed through the SubDocument.Comments property.

Expanded Add a comment

  • To create a comment, use CommentCollection.Create method. It allows you to create a comment with the specified settings, such as author or creation date.

    Note

    A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

  • To create a nested comment, use the CommentCollection.Create method with the parent comment set as an argument.

    Note

    A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

Expanded Edit a comment

To edit the comment content, use the Comment.BeginUpdate and Comment.EndUpdate paired methods. You can add any text and insert additional objects to the comment, as illustrated below.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

You can also change the comment settings by changing the corresponding Comment object properties. All the operation should be enclosed with Comment.BeginUpdate and Comment.EndUpdate paired methods as well.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

Expanded Delete a comment

To delete a comment from the document, delete it from the corresponding collection. To do that, use the CommentCollection.Remove method.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

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