[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [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
    Spell Checking
    AutoCorrect Feature
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Keyboard Shortcuts
    HTML Tag Support
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[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


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.

What is a service? 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 RichEditControl and RichEditDocumentServer inherit from base interfaces contained within the System.ComponentModel namespace of .NET - the System.IServiceProvider and System.ComponentModel.Design.IServiceContainer. You can obtain a service for the RichEditDocumentServer by using the IRichEditDocumentServer.GetService<T> method and for the RichEditControl by using 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 Scheduler 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 simply 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.XtraRichEdit.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.

Expanded See Also

How to: Customize Built-in Command Using Service Substitution
Is this topic helpful?​​​​​​​