Skip to main content
A newer version of this page is available. .

How to: Check Spelling of a Grid Cell

  • 2 minutes to read

The following example demonstrates how to check the spelling of a GridControl cell’s content:

  1. Implement the DXSpellChecker behavior for the GridControl. Refer to the Lesson 3 - Configure Spelling Check in XAML topic for details.
  2. Handle a current GridControl view‘s GridViewBase.ShownEditor event that is raised when the grid cell is activated. Retrieve the active editor and run the spell checker as shown below:

    Private Sub CardView_ShownEditor(ByVal sender As Object, ByVal e As EditorEventArgs)
        Dim cardView = (TryCast(sender, CardView))
        Dim activeEditor As BaseEdit = cardView.ActiveEditor
        If SpellChecker.SpellCheckMode = DevExpress.XtraSpellChecker.SpellCheckMode.OnDemand Then
            CheckActiveEditor(activeEditor)
        End If
    End Sub
    Private Sub CheckActiveEditor(ByVal activeEditor As BaseEdit)
        activeEditor.Dispatcher.BeginInvoke(New Action(Sub()
            If SpellChecker.CanCheck(activeEditor) Then
                SpellChecker.Check(activeEditor)
            End If
        End Sub), DispatcherPriority.Loaded)
    End Sub
    
  3. In the SpellChecker.CheckCompleteFormShowing event handler, set the Handled property to true to prevent showing The spelling check is complete dialog box when the grid control’s editor does not contain errors:

    Private Sub Checker_CheckCompleteFormShowing(ByVal sender As Object, ByVal e As DevExpress.XtraSpellChecker.FormShowingEventArgs)
        e.Handled = True
    End Sub
    
  4. As a result, the spelling form is invoked when the editor is activated. If the SpellingSettings.CheckAsYouType property is set to true, the misspelled words are highlighted.

    DXSpellChecker_GridCell