[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Collapse]Spell Checker
   [Expand]Product Information
   [Expand]Getting Started
    Spell Check Algorithms
    Check Spelling in Different Controls
    Spell Checker Properties
   [Expand]Visual Elements
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Check Spelling in Different Controls

The SpellChecker component provides the capability to check text in a wide range of text-aware controls. To see a list of controls supported by SpellChecker, see the Supported Controls topic. This document describes methods for enabling spell check in your application. To learn about spell checking algorithms, and what should be done prior to starting spell check, refer to Spell Check Algorithms.

Expanded Check a Control

To enable the control to be processed by SpellChecker, the control's CanCheckText on spellChecker extender property must be set to True. To modify this property, you can use the Properties window at design time within Visual Studio, or set this property at runtime using the SpellChecker.GetCanCheckText and SpellChecker.SetCanCheckText methods.

To check the text within a control, call the SpellChecker.Check method with this control as a parameter:

Expanded Check Any Text-Aware Control

The SpellChecker.Check method can check text from any control. Just pass the text value to the Check method and you'll be returned the text processed by the spell-checker engine.

Expanded Check Controls in a Container

The SpellChecker component provides the capability to check the text of controls placed in a control container. You can do this by calling the SpellChecker.CheckContainer method, with this container as a parameter. The controls in the container (the only controls allowed to be checked, where the value of the CanCheckText on spellChecker extender property is True) are checked in their tab order according to the SpellChecker options customized for each individual control.


Only use the SpellingFormType.Outlook setting of the SpellChecker when the SpellChecker.CheckContainer method is executed.

Expanded Check All Controls On a Form

To check all Supported Controls on a form, just call the SpellChecker.CheckContainer method.

Expanded Check-As-You-Type for All Controls On a Form

To switch the check-as-you-type mode for all Supported Controls on a form, set the SpellChecker.ParentContainer property to the current form and set the CheckAsYouTypeOptions.CheckControlsInParentContainer property to true, as in the following code:

Expanded Register Custom Controls

Usually, a set of Supported Controls can cover your requirements. In other situations, you can send the text to be checked (for example, the value of the control's Text property) to the SpellChecker as a string, calling the SpellCheckerBase.Check method of the spell checker instance with a string argument. In this case, the Spelling Dialog is invoked when the process requires user interaction. The method returns a string of corrected text.

If a control does not belong to any of the supported types, you can create a custom controller for your control. The controller should implement the DevExpress.XtraSpellChecker.Parser.ISpellCheckTextController interface, to allow the SpellChecker to interact with it.

To register your control to enable spell checking, use the SpellCheckTextControllersManager.Default.RegisterClass method, and pass the type of your editor and TextController classes. If your editor is a TextEdit descendant, you can use the following code:

If the editor is derived from the standard TextBox class, the code should be:

To allow checking with the SpellChecker.SpellCheckMode property set to SpellCheckMode.AsYouType, an additional registration procedure is needed. Call the SpellCheckTextBoxBaseFinderManager.Default.RegisterClass method of the DevExpress.XtraSpellChecker.Native namespace, as illustrated in the code snippet below:

The control must be registered by calling this code, prior to calling the SpellChecker.Check method. Call the SpellCheckTextBoxBaseFinderManager.Default.UnregisterClass method to disable spelling check.

Expanded See Also

Is this topic helpful?​​​​​​​