Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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]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
    Syntax Highlighting
    Traversing the Document
   [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]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]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Services

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 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 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.

Note

Instead of the utilizing the GetService -> RemoveService -> AddService method sequence you can use the generic IRichEditDocumentServer.ReplaceService<T> method (the RichEditControl.ReplaceService<T> 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.

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