TX Spell .NET for WPF

TXSpellChecker

Topic

TXSpellChecker is the spell checker of TX Spell .NET for WPF that you declare in the XAML of a window. It checks the text of a TX Text Control editor as the user types, checks the text of other controls on request, and brings the spell check dialog, the options dialog and the items of the spell check context menu. What follows describes what it does, how it connects to your controls and which members you use most.

What TXSpellChecker Is

The class is TXTextControl.WPF.Proofing.TXSpellChecker. It has no user interface of its own and isn't placed in the layout of a window: you declare it as a resource, and its dialogs and menus open only when a user or your code asks for them.

It comes with the NuGet package TXTextControl.TXSpell.WPF.SDK, in the assembly TXSpell.WPF.dll. The package brings the US English dictionary, hyphenation list and thesaurus with it. Code that uses the spell checker needs two namespaces: TXTextControl.WPF.Proofing for the spell checker and its dialogs, and TXTextControl.Proofing for the classes and enumerations it shares with the other TX Spell .NET products.

What You Do With It

One TXSpellChecker serves every control of a window: the dictionaries are loaded once, and a word the user adds to a user dictionary counts in all editors. Checking Multiple Controls shows how.

How You Connect It

To connect it to TX Text Control, declare the spell checker as a resource of the window and set the SpellChecker property of the TextControl to its key. As-You-Type Checking shows the XAML, and Create Your First WPF Application builds such a window step by step.

A RichTextBox, a TextBox or any other control doesn't talk to the spell checker itself: your code passes its text to Check and applies the corrections. Product Architecture describes the steps, and Checking on Demand shows the code.

Key Members

GroupMembersPurpose
CheckingCheck, IncorrectWords, IgnoreWord, IgnoreCaseFind misspelled words, and choose which words are skipped
SuggestionsCreateSuggestions, SuggestionsCreate the corrections for a word
DictionariesDictionaries, Language, AvailableDictionariesLoad dictionaries and user dictionaries, and choose the default one
HyphenationGetHyphenationPoints, HyphenationLists, HyphenationLanguageHyphenate words
SynonymsCreateSynonyms, SynonymListsLook up synonyms
Language detectionDetectLanguageScopes, DetectableLanguageScopesFind out in which language a text is written
User interfaceSpellCheckDialog, OptionsDialog, GetMenuItems, SpellingCorrectionUIProviderOpen the dialogs, build menus and correction panels
EventsIncorrectWordChanging, MisspelledWordChanging, SpellCheckDialogClosing, UserDictionaryWordAddedReact to corrections, the dialog and the dictionaries
Language data foldersDictionariesDirectoryPath, HyphenationListsDirectoryPath, SynonymListsDirectoryPath, LanguageRecognitionDirectoryPathRead the language data from other folders than the defaults

Events lists all events, and the TXSpellChecker reference all members.

Next Steps