C1SpellChecker Sample
--------------------------------------------------------------------------------
Shows how to use the C1SpellChecker object to check plain text, TextBox, and C1RichTextBox controls.

The sample shows how to load spell dictionaries, how to spell-check strings (CheckText), how to
spell-check controls using a spell dialog (CheckControl), and how to enable as-you-type spell
checking on a C1RichTextBox.

C1SpellChecker uses two types of spell dictionaries. The main dictionary is a large, read-only, compressed
word list that is distributed with the control. ComponentOne includes spell dictionaries for over 15 
languages. The sample loads the main dictionary (C1Spell_en-US.dct) using this code:

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

This is done asynchronously, as the application starts up. If you don't load the main dictionary, you won't
be able to spell-check.

Besides the main dictionary, C1SpellChecker has a 'user' dictionary that is a smaller, read-write word list
customizable by the developer and by users (through the "Add" button in the Spell Dialog). The user dictionary
is optional. It is commonly used to add terms that make sense for particular users, such as names, technical 
terms, etc. The sample loads the user dictionary (Custom.dct) using this code:

	// load user dictionary
	UserDictionary ud = c1SpellChecker1.UserDictionary;
	ud.LoadFromIsolatedStorage("Custom.dct");
	
This loads the user dictionary from isolated storage. To save any changes back to storage when the application
is done, the sample uses this code:

	void App_Exit(object sender, EventArgs e)
    {
		// save modified user dictionary into compressed isolated storage
        UserDictionary ud = c1SpellChecker1.UserDictionary;
        ud.SaveToIsolatedStorage("Custom.dct");
	}
	
This saves the modified user dictionary back into isolated storage (in compressed format).

The sample demonstrates modal spell-checking using a TextBoxHideSelection class instead of a regular TextBox.
TextBoxHideSelection extends the regular Silverlight TextBox and adds a single HideSelection property. Setting
this property to false causes the control to keep the selection visible even when the control doesn't have
the focus, which is useful while spell-checking. Hopefully this useful property will be added to the TextBox
control in a future Silverlight release.




