[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
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    HTML Tag Support
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [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
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)


To minimize the chance of breaking changes in future versions, we have separated the actual implementation of a feature in code from the implementation of methods used to access this feature. We manage this task via extensive use of interfaces. It was also necessary to find a way to break apart dependencies in the application and achieve looser coupling between its parts. This approach usually results in greater extensibility.

To achieve this, we follow a concept of services and service containers, implemented in .NET framework.

Service is a class with a known interface, addressable by its type. A service can be obtained from a service provider, instantiated and stored within a service container. The RichEdit Control incorporates classes and interfaces that inherit from base interfaces, contained within the System.ComponentModel namespace of .NET - firstly, the System.IServiceProvider and System.ComponentModel.Design.IServiceContainer. You can obtain a service by using the generic RichEditControl.GetService<T> method.

When you get a service via the GetService method, you actually use the specified interface to obtain a pointer to an object that implements the methods of this interface. You can save this pointer (and the object it references), and delete the service implementation from the RichEditControl with the help of the RichEditControl.RemoveService method. When it is done, the corresponding GetService method will return null.

At that time, you can install your own service using the RichEditControl.AddService method. Subsequent calls to GetService will return the pointer to an object representing your service. So, the calls to service methods are redirected from the default implementation to a custom one. It is done silently and transparently for the caller.

This mechanism enables you to modify the default behavior of an application that uses these services at any time, without re-designing it.


Instead of the utilizing the GetService -> RemoveService -> AddService method sequence you can use the generic DevExpress.XtraRichEdit.IRichEditDocumentServer.ReplaceService``1 method (the DevExpress.Xpf.RichEdit.RichEditControl.ReplaceService``1 method for the RichEditControl).

RichEditControl implements the following services.

Service Description
IRichEditCommandFactoryService Enables you to substitute default RichEdit commands or create your own.
IUriProviderService Enables you to specify custom locations for exported images and styles.
IUriStreamService Used to retrieve data from the URI, specified in some types of document fields.
IUserListService Provides a list of identities to fill the Editing Permissions form.
IUserGroupListService Provides a list of user groups to fill the Editing Permissions form.
IAutoCorrectService Defines a service that performs auto correction.
ISyntaxHighlightService Enables you to implement the text highlighting functionality.
IProgressIndicationService Exposes functionality that enables you to display a progress indicator for time-consuming operations. See the sample project available in the DevExpress Code Central database at http://www.devexpress.com/example=E3293.

Register the service after the RichEditControl is completely loaded, i.e. in the RichEditControl.Loaded event handler.

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