TX Text Control: Using a Custom Spell Check ContextMenu

When TX Spell .NET is connected to a TextControl through the SpellChecker property, TextControl provides a pre-defined spell check context menu that can be used to replace the misspelled word, open the SpellCheckDialog or to open the options user dialog. But sometimes, it is required to create a customizable context menu or to include the spell check menu items into an existing menu.

The source code is contained in the following directories:

  • Samples\WPF\CSharp\TextControl\Context menu strip
  • Samples\WPF\VB.NET\TextControl\Context menu strip

TX Spell .NET provides the GetMenuItems method that returns ready-to-use menu items that can be inserted into an existing ContextMenuStrip. The method accepts a misspelled word, the connected TextControl instance and the maximum number of returned suggestions.

TXTextControl.WPF.Proofing.MenuItem[] items = txSpellChecker1.GetMenuItems(misspelledWord, textControl1, 5);
Dim items As TXTextControl.WPF.Proofing.MenuItem() = txSpellChecker1.GetMenuItems(misspelledWord, textControl1, 5)

TX Spell .NET provides different MenuItemTypes for different purposes such as deleting, ignoring or to add a word to a user dictionary.

Start the sample application and right-click on a misspelled word (red zig-zag line). You can replace the misspelled word with a correct suggestion, you can ignore it or you can add it to the user dictionary.

Image