-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomCommandService.vb
More file actions
40 lines (34 loc) · 1.51 KB
/
CustomCommandService.vb
File metadata and controls
40 lines (34 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Spreadsheet
Imports DevExpress.XtraSpreadsheet
Imports DevExpress.XtraSpreadsheet.Commands
Imports DevExpress.XtraSpreadsheet.Services
Imports System
Imports System.Windows
Namespace WpfSpreadsheet_CustomCommand
Public Class CustomService
Inherits SpreadsheetCommandFactoryServiceWrapper
Public Sub New(ByVal service As ISpreadsheetCommandFactoryService)
MyBase.New(service)
End Sub
Public Property Control() As SpreadsheetControl
Public Overrides Function CreateCommand(ByVal id As SpreadsheetCommandId) As SpreadsheetCommand
If id = SpreadsheetCommandId.FormatClearContents OrElse id = SpreadsheetCommandId.FormatClearContentsContextMenuItem Then
Return New CustomFormatClearContentsCommand(Control)
End If
Return MyBase.CreateCommand(id)
End Function
End Class
Public Class CustomFormatClearContentsCommand
Inherits DevExpress.XtraSpreadsheet.Commands.FormatClearContentsCommand
Public Sub New(ByVal control As ISpreadsheetControl)
MyBase.New(control)
End Sub
Protected Overrides Sub ExecuteCore()
Dim result As MessageBoxResult = DXMessageBox.Show("Do you want to clear the cell content?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
If result = MessageBoxResult.Yes Then
MyBase.ExecuteCore()
End If
End Sub
End Class
End Namespace