What's New in TX Spell .NET for WPF 3.0
Better suggestions and a spell check dialog you can change were the two main goals of TX Spell .NET for WPF 3.0. The version also added events for dictionaries, user dictionaries and dialog buttons, loaded dictionaries from string arrays instead of files, and returned ready-made items for a context menu of your own.
Version 3.0 was released on September 12, 2012, on its own rather than together with a version of TX Text Control, as the blog article TX Spell .NET 3.0 Released: New Suggestion Engine, Customizable Dialog announced. It lists the features added since version 2.0; the next version is Version 4.0.
Version 3.0 at a Glance
| Area | What is new |
|---|---|
| Suggestions | Ranking that takes the distance between keys of the current keyboard into account |
| Spell check dialog | SpellCheckDialog with buttons, fonts and a preview you can change, for TX Text Control and other controls |
| Events | Dictionaries added and removed, words added to and removed from user dictionaries, dialog buttons clicked, words changed |
| Dictionaries | Dictionaries and user dictionaries created from string arrays |
| Context menus | GetMenuItems returns the spell checking items of a context menu |
| Code without a user interface | The TXSpell class |
Suggestion Ranking
The suggestion engine was rebuilt for version 3.0. To rank the suggestions for a misspelled word, it measures how far apart the keys of the current keyboard are, so that a letter typed with the key next to the intended one counts as a likely typo. Text Control tested the engine with thousands of documents: in more than 97 percent of the test cases, the suggestion the user expected was ranked first or second.
The suggestions of today's version still take the keyboard into account; Incorrect Words and Suggestions shows how to create them in code.
A Customizable Spell Check Dialog
TXSpellChecker gained the SpellCheckDialog property, which returns the built-in dialog as an object you can change before you open it with Show. The dialog works with TX Text Control and with other controls, such as a RichTextBox or a TextBox, and one dialog can check the text of several controls in a single pass.
- Buttons. ChangeButtons, IgnoreButtons and OptionButtons are collections of DialogButton objects, whose text, font and state you set. Buttons of your own are added with Add.
- Preview. Preview gives access to the dialog's preview of the text. Editable decides whether the user can edit it, and IncorrectWordColor sets the color of the misspelled word, red by default.
- Suggestions. The dialog's SuggestionList and SuggestionDictionaryComboBox set how many suggestions are shown and from which dictionary they come.
- Behavior. CloseOnFinished, ShowMessageBoxes, ChangeInAllTextParts and IgnoreInAllTextParts control what happens when the check ends and whether a change applies to every part of a TX Text Control document.
- State. A SpellCheckDialogStateManager is passed to the dialog's events. Its SetNext method hands the dialog the next text, word or control to check, which is how one dialog checks several controls.
Spell Check Dialog describes the dialog and Customizing the Spell Check Dialog changes its buttons, fonts and preview.
New Events
TXSpellChecker raises events for the actions of the user and of your code:
- Dictionaries. DictionaryAdded and DictionaryRemoved occur when the dictionary collection changes.
- User dictionaries. UserDictionaryWordAdded and UserDictionaryWordRemoved occur when a word is added to or removed from a user dictionary.
- Changes of words. IncorrectWordChanging and MisspelledWordChanging occur before a word is replaced, deleted or ignored. WillBeDuplicate tells whether a replacement would create a duplicated word.
- Dialogs and menus. SpellCheckDialogOpening, SpellCheckDialogClosing, DialogButtonClicked, OptionsDialogOpening and MenuItemClicked follow the dialogs and the context menu.
Events shows what each event is for.
Dictionaries From Memory
Dictionaries no longer have to be files. An OpenOfficeDictionary can be created from the lines of its dictionary file and its affix file as two string arrays, and a UserDictionary from an array of its lines and a language. The dictionaries can then come from embedded resources or a database, and user dictionaries can be saved to a string array as well. The blog article TX Spell .NET 3.0: Loading Dictionaries from Embedded Resources loaded a dictionary this way when the version was new; Loading and Managing Dictionaries does it with the current version.
Service Packs
- Service Pack 1, released on November 22, 2012, made TX Spell .NET 3.0 compatible with Visual Studio 2012. It came as a new setup of the full version, which you ran with Repair. The blog article TX Spell .NET 3.0 SP1 - Visual Studio 2012 Compatibility Pack Released announced it.
- Service Pack 2 followed on June 25, 2013, with fixes for known issues, as the blog article TX Spell .NET 3.0 Service Pack 2 Released announced.
The download package holds the setup TX Spell .NET for WPF 3.0 SP2.exe, dated June 24, 2013, and the full version setup TX Spell .NET for WPF 3.0.exe, dated June 18, 2013. These are the dates of the setup files, not release dates.
New Classes, Properties, Methods and Events
The classes and members below are the ones that the What's New documentation of version 3.0 lists for TX Spell .NET for WPF. Names are relative to the TXTextControl namespace, and each name links to its current reference page. It gives SuggestionDictionaryComboBox a second time, in the TXTextControl.Proofing namespace; that class belongs to TX Spell .NET for Windows Forms and is left out here.
New Classes
- Proofing.DictionaryAddedEventArgs
- Proofing.DictionaryCollection
- Proofing.DictionaryRemovedEventArgs
- Proofing.IncorrectWordChangingEventArgs
- Proofing.MisspelledWordChangingEventArgs
- Proofing.SpelledWord
- Proofing.TXSpell
- Proofing.UserDictionaryWordAddedEventArgs
- Proofing.UserDictionaryWordRemovedEventArgs
- WPF.Proofing.DialogButton
- WPF.Proofing.DialogButtonCollection
- WPF.Proofing.DialogButtonEventArgs
- WPF.Proofing.MenuItem
- WPF.Proofing.MenuItemClickedEventArgs
- WPF.Proofing.OptionsDialogOpeningEventArgs
- WPF.Proofing.Preview
- WPF.Proofing.SpellCheckDialog
- WPF.Proofing.SpellCheckDialogClosingEventArgs
- WPF.Proofing.SpellCheckDialogOpeningEventArgs
- WPF.Proofing.SpellCheckDialogStateManager
- WPF.Proofing.SuggestionDictionaryComboBox
- WPF.Proofing.SuggestionList
- WPF.Proofing.TXSpellChecker
Members by Class
Next Steps
- Version 4.0: hyphenation, checking in a given language and right-to-left languages.
- Older Versions: all versions from 3.0 to 6.0 at a glance.
- Customizing the Spell Check Dialog: change the dialog of today's version.