XtraSpellChecker: A simple but powerful spell checker for WinForms applications

WinForms Team Blog
17 September 2007

You can easily provide spell checking capabilities to your WinForms applications with XtraSpellChecker.


Compatible Controls

The Spell Checker can check the spelling of almost any control that has a Text property. Some examples of supported controls:

  • System.Windows.Forms.TextBox
  • DevExpress.XtraEditors.TextEdit
  • DevExpress.XtraEditors.MemoEdit
  • System.Windows.Forms.RichTextBox (Next Release, 2007 vol 3)

The XtraSpellChecker can check with our WinForms grids (e.g. XtraGrid, XtraVerticalGrid, etc.) as well since they contain TextEdit and MemoEdit editors for their cells.

You can also check any arbitrary text by passing it to the Check method as a parameter.

Components To Use

The main component, which provides all spell checking abilities, is the SpellChecker. The clip_image001SpellChecker is located in the “DX: Win.v7.2” tab in the Visual Studio toolbox. You can also create it at runtime:

using DevExpress.XtraSpellChecker;

SpellChecker spellChecker1 = new SpellChecker();

You can now set some it's properties like the default for Culture property. This specifies culture settings (the symbols encoding, language and phonetic specifics):

spellChecker1.Culture = new System.Globalization.CultureInfo("en-US");

Please note that if you use several SpellChecker components and one dictionary, then a clip_image002SharedDictionaryStorage component is required.

Enable Spell Checking

The SpellChecker component provides two methods to check the spelling for controls: Check() and CheckContainer().

The following code demonstrates how to pass a text to the Check method:

private void simpleButton1_Click(object sender, EventArgs e) { 
   textBox1.Text = spellChecker1.Check(textBox1.Text);

The Dictionaries

The SpellChecker component uses special spell checking algorithms. Every algorithm requires a dictionary, which provides the list of words and/or rules to generate this list. To enable spell checking in your application you need to define at least one dictionary.

First choose which dictionary best meets your requirements. The XtraSpellChecker suite supports four basic dictionary types.

  • Simple
  • ISpell
  • Open Office
  • Custom

Dictionaries can be defined both at design and runtime. For example, at runtime you can create an ISpell dictionary:

    iSpellDictionary = new SpellCheckerISpellDictionary();
   iSpellDictionary.Culture = new CultureInfo("en-US");
   iSpellDictionary.AlphabetPath = @"\Dicts\Dicts\ISpell\EnglishAlphabet.txt";
   iSpellDictionary.DictionaryPath = @"\Dicts\Dicts\ISpell\american.xlg";
   iSpellDictionary.GrammarPath = @"\Dicts\Dicts\ISpell\english.aff";

You'll see each of these dictionaries described in more detail in an upcoming post.

Download and try the XtraSpellChecker today. The XtraSpellChecker Suite is part of the DXperience Professional and Enterprise Suites. Currently, the XtraSpellChecker Suite is for Windows Forms only. However, an ASP .NET version is being developed.

Are you using the XtraSpellChecker in your apps? I'd love to hear your stories with this amazing little control.

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
Stefan Renzewitz
Stefan Renzewitz

Aaargh, you simply write System.Windows.Forms.RichTextBox but the hyperlink doesn't work to check out the details!!! :)

18 September 2007
Stefan Renzewitz
Stefan Renzewitz

Sorry, my post makes no sense. Looks like I just wanted to read XtraRichTextbox. Never mind.

18 September 2007
Mehul Harry (DevExpress)
Mehul Harry (DevExpress)

Hi Stefan,

I don't like underlined text that is not hyperlinked either. So I've removed the underlines.


18 September 2007
Alan (DevExpress)
Alan (DevExpress)

Stefan, sorry, I would be happy to write "XtraRichTextBox" ;-), but unfortunately it isn't yet ready, and its release date isn't established...

That statement means that we've implemented the ability to check the spelling within a standard RichTextBox control in our internal builds, and this ability will be released in v2007 vol 3 later this year.

19 September 2007
Windows Forms

In a previous post , you learned about the XtraSpellChecker component. Now let's dig deeper and see

20 September 2007
Windows Forms

Did you know that the XtraSpellChecker Suite can check spelling as you type? Just like in MS Word or

24 September 2007
Brendon Muck [DevExpress MVP]
Brendon Muck [DevExpress MVP]

I attempted to use the XtraSpellChecker is a seemingly novel way: to validate a city/state combination entered by a User.

Unfortunately, as this exchange (www.devexpress.com/.../CQ61272.aspx) with DX Support exhibits, the XtraSpellChecker component considers whitespace to be a word-delimiter, and essentially made this impossible (or at least very difficult to implement).

Regardless, my other experiments with the XtraspellChecker component have been nothing but successful and impressive. I think it's a great little (or big) addition to the already fantastic DX suite!

25 September 2007
Alan (DevExpress)
Alan (DevExpress)

Hi Brendon,

Thank you for your compliments regarding the XtraSpellChecker! I've passed them to the XtraSpellChecker developers.

As for your task, we've discussed it and decided to improve our component, so to make it possible  to edit a word-delimiters list. For example, if we add the SpellChecker.WordDelimiters public property, which will allow you to edit a list of word-delimiters (e.g. remove the whitespace from this list), will this suit your needs? If yes, we may try to implement it for the next major version of the Suite.

In any case, using a SpellChecker to check input errors of such a kind seems to be a very interesting idea - thank you for sharing your experience with us!

26 September 2007
Brendon Muck [DevExpress MVP]
Brendon Muck [DevExpress MVP]

I think that idea might in fact work. For my application, I'd need an ability to ignore white space and use a custom delimiter. I suppose in the end, I'd have a dictionary file that might look something like this:



St. Petersburg|FL

Where | is the actual delimiter, and the whitespace in "St. Petersburg" (and the period for that matter) is ignored.

26 September 2007
Alan (DevExpress)
Alan (DevExpress)

Hi Brendon,

We've added this suggestion to our plans for the next major version. You may track its state here: www.devexpress.com/issue=S18198.

27 September 2007

Please login or register to post comments.