ComponentOne SpellChecker for WPF and Silverlight
MainDictionary
Working with C1SpellChecker > Concepts and Main Properties > Spelling Dictionaries > MainDictionary

The main dictionary is a read-only, compressed word list that contains a few hundred thousand words. The main dictionary is loaded when the application starts, using the LoadAsync method as illustrated below:

C#
Copy Code
  public Page()
  {
    InitializeComponent();

     // Other initialization...
 
    // Load main dictionary
    SpellDictionary md = c1SpellChecker1.MainDictionary;
    md.LoadCompleted += md_LoadCompleted;
    md.LoadProgressChanged += md_LoadProgressChanged;
    md.LoadAsync("C1Spell_en-US.dct");
  }

The LoadAsync method takes the URL of the spelling dictionary as a single parameter, which is typically deployed as part of the application. The example above loads the C1Spell_en-US.dct which is the US English spelling dictionary that ships with C1SpellChecker. This dictionary contains about 120,000 words and is about 250k bytes in size.

The LoadAsync method loads the main dictionary asynchronously, so your application can start while the dictionary is downloaded from the server. When the download is complete, the dictionary calls the LoadCompleted event, which you can use to determine when the C1SpellChecker component is ready for work.

You can use the MainDictionary.State property to check at any time whether the main dictionary has successfully loaded.

You can also load the main dictionary from a Stream object, so you can customize the loading process if you want.

 

See Also