Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

SpreadsheetCommandFactoryServiceWrapper Class

A base class for implementing custom services used to substitute the default command factory service.

Namespace: DevExpress.XtraSpreadsheet.Services

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

public class SpreadsheetCommandFactoryServiceWrapper :
    ISpreadsheetCommandFactoryService

Remarks

All commands in the SpreadsheetControl are created using the command factory service. You can substitute the default command factory service with its descendant designed to create a custom command instead of the default command. Subsequently, the specified custom command is used in all SpreadsheetControl operations instead of the replaced command.

The following code snippet demonstrates a custom service used to substitute the Clear Contents formatting commands located in Ribbon and context menu with a custom command.

public class CustomService : SpreadsheetCommandFactoryServiceWrapper {
    public CustomService(ISpreadsheetCommandFactoryService service)
        : base(service) {
    }
    public SpreadsheetControl Control {get;set;}

    public override SpreadsheetCommand CreateCommand(SpreadsheetCommandId id)
    {
        if (id == SpreadsheetCommandId.FormatClearContents || id == SpreadsheetCommandId.FormatClearContentsContextMenuItem)
            return new CustomFormatClearContentsCommand(Control);

        return base.CreateCommand(id);
    }

}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SpreadsheetCommandFactoryServiceWrapper class.

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.

Inheritance

Object
SpreadsheetCommandFactoryServiceWrapper
See Also