GetCustomDictionaries Method
Collapse the table of content
Expand the table of content

SpellCheck.GetCustomDictionaries Method

Gets the collection of lexicon file locations that are used for custom spelling checkers on a specified text-editing control.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public static IList GetCustomDictionaries(
	TextBoxBase textBoxBase


Type: System.Windows.Controls.Primitives.TextBoxBase
The text-editing control whose collection of lexicon files is retrieved.

Return Value

Type: System.Collections.IList
The collection of lexicon file locations.


The textBoxBase is null.

Custom dictionaries use lexicon files, which are simple text files that have a .lex extension. Each line of a lexicon file contains a single word that is accepted as a legitimate spelling. The first line of the file can specify a locale identifier (LCID) that the dictionary applies to. If the locale is not specified, the dictionary applies to all languages. For more information, see Locale IDs. The following example shows the first few lines of a lexicon file for the English language.

#LID 1033

To specify one or more custom dictionaries for a TextBox or any class that derives from TextBoxBase, specify the location of the lexicon file by adding the URI for the file to the IList returned by the GetCustomDictionaries method.

To enable the spelling checker, set the SpellCheck.IsEnabled property to true on a TextBox or on any class that derives from TextBoxBase. All custom dictionaries for that TextBox are used in addition to the default spelling checker. For more information about the spelling checker, see SpellCheck.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft