Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
   [Expand]Member Tables
    Keyboard Shortcuts
    HTML Tag Interpretation
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report 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 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.

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.

Expanded See Also

How would you rate this topic?​​​​​​​