This example illustrates the technique used to modify the functionality of existing SpreadsheetControl commands.
The SpreadsheetControl exposes the ISpreadsheetCommandFactoryService interface that enables you to substitute the default command with your own custom command.
-
Create a custom command class, inherited from the command that you wish to replace. Override the required methods of the command.
-
Create a class inherited from the SpreadsheetCommandFactoryServiceWrapper, intended to substitute a default command service. In this class, override the CreateCommand method to create an instance of a custom command class, an identifier of the currently processed command is passed as a parameter of this method.
-
Use the
SpreadsheetCommandFactoryServiceWrapper
class descendant to substitute the default command service.
- CustomFormatClearContentsCommand.cs (VB: CustomFormatClearContentsCommand.vb)
- CustomService.cs (VB: CustomService.vb)
- Form1.cs (VB: Form1.vb)
(you will be redirected to DevExpress.com to submit your response)