-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.vb
29 lines (25 loc) · 1.1 KB
/
MainWindow.xaml.vb
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
Imports DevExpress.Xpf.Core
Imports DevExpress.XtraSpreadsheet.Services
Imports System
Namespace WpfSpreadsheet_CustomCommand
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits ThemedWindow
Public Sub New()
InitializeComponent()
End Sub
Private Sub spreadsheetControl_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
Dispatcher.BeginInvoke(New Action(Sub()
SubstituteService()
End Sub), System.Windows.Threading.DispatcherPriority.Render)
End Sub
Private Sub SubstituteService()
Dim service As ISpreadsheetCommandFactoryService = DirectCast(spreadsheetControl.GetService(GetType(ISpreadsheetCommandFactoryService)), ISpreadsheetCommandFactoryService)
Dim customService As New CustomService(service)
spreadsheetControl.ReplaceService(Of ISpreadsheetCommandFactoryService)(customService)
customService.Control = spreadsheetControl
End Sub
End Class
End Namespace