Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Collapse]Spell Checker
   [Expand]Product Information
   [Collapse]Getting Started
     Lesson 1 - Add Spell Checking to Your Application
     Lesson 2 - Create Simple Application to Check Spelling in MemoEdit
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 1 - Add Spell Checking to Your Application

This topic will show how to add spell-check functionality to your application, using the SpellChecker component. Dictionaries for US English are built-in and will be used by default.

Note

If no dictionary is specified, SpellChecker uses default English dictionary. When any other dictionary is added, even a custom dictionary, default dictionary is not loaded.

The SpellChecker component can check the spelling of a wide range of text-aware controls. For more information, refer to Supported Controls.

Please follow the steps below.

Expanded Step 1. Add a SpellChecker Component

Add the SpellChecker component to your project. To do this, simply drag the corresponding item from the DX.17.1: Components toolbox tab, and drop it onto the form that contains text controls.

Expanded Step 2. Check Spelling On Demand

To start checking the spelling in all supported controls on the form when clicking the button:

  1. Add the SimpleButton control (located on the DX.17.1: Common Controls toolbox tab) to the form;
  2. Subscribe to the button's Click event.
  3. To start spell checking and invoke the spelling dialog to make corrections when you click the button, set the SpellChecker.SpellCheckMode property to SpellCheckMode.OnDemand and call the SpellChecker.CheckContainer method.

Expanded Step 3. Check Spelling As You Type

To enable SpellChecker to check the spelling of all supported controls on the form as you type:

  1. Subscribe to the form's Load event;
  2. Add the following code to the Load event handler:

    This code instructs the SpellChecker to underline the misspelled word when the end-user finishes typing the word or moves the cursor after changing it, and allows selecting a suggestion from the context menu, invoked by right-clicking the word.

  3. To perform spell check as you type, use the following code.

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2413.

    This underlines the misspelled word when the end-user finishes typing the word or moves the cursor after changing it, and allows you to select a suggestion from the context menu, invoked by right-clicking the word.

Expanded Step 5. User Interaction

When SpellChecker encounters a word that is not found within available dictionaries, or a duplicated word, the Spelling dialog can be used for making corrections. It is invoked, when the end-user starts checking spelling on demand (calls the SpellChecker.Check method), or selects the Check Spelling item from the context menu.

Generally, the Spelling dialog of the SpellingFormType.Outlook type will best suit the user.

You can, however, change it to the more versatile SpellingFormType.Word, shown in the picture below, using the SpellCheckerBase.SpellingFormType property.

In this dialog, the end-user can replace the current occurrence or all occurrences of the misspelled word with one of the suggested corrections, ignore this word once or all its occurrences, or add the word to the dictionary of the SpellChecker.

The Options... button enables the end-user to change the spelling options or the language dictionary to be used, and provides access to the custom dictionary editor. The Undo button can cancel the changes, step by step.

How would you rate this topic?​​​​​​​