Skip to main content
A newer version of this page is available. .

SpreadsheetControl.ReplaceService<T>(T) Method

Performs a service substitution.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v18.2.dll

Declaration

public T ReplaceService<T>(
    T newService
)
    where T : class

Parameters

Name Type Description
newService T

A service of the specified type that will be registered.

Type Parameters

Name
T

Returns

Type Description
T

Previously registered service of the specified type, or null (Nothing in Visual Basic) if the service does not exist.

Remarks

The following code snippets illustrate how to create a custom service and register it.

MyMessageBoxService svc = new MyMessageBoxService(spreadsheetControl1, spreadsheetControl1.LookAndFeel);
spreadsheetControl1.ReplaceService<DevExpress.XtraSpreadsheet.Services.IMessageBoxService>(svc);
See Also