Custom Dictionaries

Most current editors provide built in spell checking which validates user input. Spell checkers can be found in anything from word processors, to email clients, and even web browsers. Depending on the scenario, these spell checking utilities vary in complexity. Simple spell checkers compare the input against a default dictionary and then highlight mismatches. More complex spell checkers allow dynamic modification of the dictionary.


WPF includes a spell checker, but currently it only uses the OS provided dictionary for input validation. It lacks the functionality to allow the default dictionaries to be augmented with custom dictionaries provided by an application. This has been a major issue for apps which target specific industries with specialized lingo. Those apps are plagued by misspelling notifications.


A chat client is a classic example of an application that displays specialized words. In such an application, web slang such as lol, brb, or ttyl is frequently used. While these acronyms are not official words in English, in the context of a chat client these are not misspelled words.


This problem has been fixed in WPF 4.0. The ability to augment spelling support, via an application provided custom dictionary, has been added to the framework.




Custom Dictionaries API

The property CustomDictionaries has been added to the SpellCheck class.

·        CustomDictionaries - This is a read-only dependency property which is an IList of URIs. Each URI points to a custom dictionary to be used for spell checking.  If spell checking is disabled, SpellCheck.IsEnabled == false, no spell checking will occur, even if a custom dictionary is provided.


Custom Dictionary Format

Custom dictionaries are simple text files with single words on each line. Each line represents a legitimate word which should not be marked as misspelled.


The first line of this file can specify a language that the custom dictionary should correspond to (e.g. “#LID 1033” means that this custom dictionary applies to US English). If no language is set, the custom dictionary will apply to all default dictionaries.

·        #LID 1033 – English

·        #LID 3082 - Spanish

·        #LID 1031 - German

·        #LID 1036 - French


Comments are not supported inside the custom dictionary file.



<Window x:Class="CustomSpellerDictionaries.MainWindow"




        Title="Custom Dictionaries Example">


        <TextBox Text="Finallly, my name, Chipalo, is not marked as misspelled."










Contents of D:\TEMP\dictionary.lex




TextBlock created with the above XAML. Notice that spell checking is enabled but “Chipalo” is not marked as misspelled.




Custom Dictionaries Suggested Usage


Custom dictionaries should be used when an application wants a set of words, which are not found in the default dictionary for a language, to not be marked as misspelled. Specifying a langue for a custom dictionary will limit the use of the dictionary to only the denoted language. A custom dictionary which is not marked as language specific will be used for spell checking in all languages which spell checking is supported.


Spelling support in WPF is limited to four languages: English, Spanish, French, and German. Custom dictionaries are designed to augment the default dictionaries for these languages and not to extend spelling support to other languages. Creating a custom dictionary which contains common Russian words, marking the dictionary as a Russian dictionary, and adding it to the SpellCheck object of a TextBox or RichTextbox will not add Russian spelling support. If the first line of a custom dictionary denotes that the dictionary is used for a language which is not supported, that dictionary will be ignored. 

 - Chipalo

Comments (10)
  1. Ruben says:

    Still no additional dictionaries? AND the CustomDictionaries API is off limits to other languages? That’s not a feature. That’s the LACK of a feature as far as I’m concerned.

  2. Junior Osei says:

    I kinda agree with Ruben. I would like to add a custom dictionary of my words, in effect, my own language. It would have been great if I could create my own language with custom dictionaries.

  3. text says:

    Ruben – I would agree that additional dictionaries and customization of existing dictionaries are distinct features.  Both features are targeted at specific scenarios and have different design considerations. For example, additional dictionaries (which support another language) are much larger than dictionary addons (which support industry specific lingo). The two need to be created, processed, and stored differently. We have done the work to support modification of existing dictionaries in WPF 4.0, and we would like to extend this work in future releases to support additional dictionaries.


  4. I would like very much if you have a window that can spell like I had in XP

  5. text says:

    Eugene – Sorry I am not sure which feature you are referring to.

  6. Luke says:

    Good to hear that custom dictionaries are in .NET 4.0.  However, where can I locate detailed information on what dictionaries are available?

    I understand only 4 languages are supported, English, German, French and Spanish are available.  But is only en-US supported, how about en-GB?

    Documentation on this topic in MSDN docs. seems sparse at best.  Where can I locate exact details on the languages supported?

  7. Nicola says:

    I agree with Ruben, this is a missing feature for all people speaking other than english, french, german or spanish.

    "…WPF includes a spell checker, but currently it only uses the OS provided dictionary for input validation…" this is exactly what is expected from a feature like this, italian dictionary for an italian OS…

    I can’t see any valid reason to limit this to only 4 languages, having MS full dictionaries for all localized Office version…

  8. Rui Marinho says:

    I also agree with Ruben and Nicola, that looks to me like the key feature that users want is the dictionary on its own language… custom dictionarys like you have down now is also good but not what is most wanted.

    Do you have that in plan for the final release of wpf4.0 ?

  9. text says:

    Luke – I’ve asked the team that makes the dictionaries about this issue and most dialects of the supported languages should be supported. Unfortunately, no good documentation exists that you can quickly reference. I threw together a quick prototype to test en-gb and it is supported. For now, you will have to test other dialects in a similar manner.






      <TextBox xml:lang=”en-us” SpellCheck.IsEnabled=”True”>Arse is also a serious condition otherwise know as Arylsulfatase E</TextBox>

      <TextBox Grid.Row=”1″ xml:lang=”en-gb” SpellCheck.IsEnabled=”True”>Arse is also a serious condition otherwise know as Arylsulfatase E</TextBox>


    Rui & Nicola – I agree that the ability to extend spelling support to other languages is a very important feature that many customers want. We would like to provide this functionality, but the feature set that we chose for .Net4.0 did not allow time for us to do this. This is a feature will not be part of .Net4.0, but we are considering for the next release of WPF.

  10. I wish that another languages would supported too. I have hope, is can be, example, open project for another dictionaries. But why nor create open web-service for every language with possibility add appropriate words. And then everybody developer and user would can update your’s dictionary at local PC?

Comments are closed.

Skip to main content