Back to Devexpress

RichEditControl.AddService(Type, Object) Method

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-dot-addservice-x28-system-dot-type-system-dot-object-x29.md

latest2.9 KB
Original Source

RichEditControl.AddService(Type, Object) Method

Adds the specified service to the service container.

Namespace : DevExpress.Xpf.RichEdit

Assembly : DevExpress.Xpf.RichEdit.v25.2.dll

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public void AddService(
    Type serviceType,
    object serviceInstance
)
vb
Public Sub AddService(
    serviceType As Type,
    serviceInstance As Object
)

Parameters

NameTypeDescription
serviceTypeType

The type of service to add.

| | serviceInstance | Object |

An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter.

|

Remarks

The RichEditControl implements IServiceProvider and IServiceContainer interfaces. In addition to providing services, it also provides a mechanism for adding and removing services. To obtain a service, call the RichEditControl.GetService method.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddService(Type, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-richedit-use-docvariable-fields/CS/MainWindow.xaml.cs#L42

csharp
richEditControl1.RemoveService(typeof(IProgressIndicationService));
richEditControl1.AddService(typeof(IProgressIndicationService),
    new MyProgressIndicatorService(richEditControl1, this.progressBarControl1));

See Also

GetService(Type)

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace