-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpreadsheetSpellChecker.vb
51 lines (42 loc) · 1.92 KB
/
SpreadsheetSpellChecker.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.SpellChecker
Imports DevExpress.Xpf.Spreadsheet
Imports DevExpress.Xpf.Spreadsheet.Internal
Imports DevExpress.XtraSpellChecker
Namespace SpreadsheetSpellchecking_WPF
Public Class SpreadsheetSpellChecker
Inherits DXSpellCheckerBase(Of SpreadsheetControl)
Private ReadOnly Property Spreadsheet As SpreadsheetControl
Get
Return AssociatedObject
End Get
End Property
Protected Overrides Sub OnAttached()
MyBase.OnAttached()
SpellingSettings.RegisterTextControl(GetType(XpfCellInplaceEditor))
SubscribeToEvents()
End Sub
Protected Overrides Sub OnDetaching()
UnsubscribeFromEvents()
SpellingSettings.UnregisterTextControl(GetType(XpfCellInplaceEditor))
MyBase.OnDetaching()
End Sub
Private Sub SubscribeToEvents()
AddHandler Me.Spreadsheet.CellEditorOpened, AddressOf OnSpreadsheet_CellEditorOpened
AddHandler SpellChecker.CheckCompleteFormShowing, AddressOf OnChecker_CheckCompleteFormShowing
End Sub
Private Sub UnsubscribeFromEvents()
RemoveHandler Me.Spreadsheet.CellEditorOpened, AddressOf OnSpreadsheet_CellEditorOpened
RemoveHandler SpellChecker.CheckCompleteFormShowing, AddressOf OnChecker_CheckCompleteFormShowing
End Sub
Private Sub OnSpreadsheet_CellEditorOpened(ByVal sender As Object, ByVal e As CellEditorOpenedEventArgs)
If Not e.IsCustom Then
e.Editor.SetValue(ThemeManager.ThemeNameProperty, ApplicationThemeHelper.ApplicationThemeName)
SpellChecker.Check(e.Editor)
End If
End Sub
Private Sub OnChecker_CheckCompleteFormShowing(ByVal sender As Object, ByVal e As FormShowingEventArgs)
e.Handled = True
End Sub
End Class
End Namespace