Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpellingExtensions Class

A base class for spell check extension methods.

Namespace: DevExpress.Xpf.SpellChecker

Assembly: DevExpress.Xpf.SpellChecker.v24.2.dll

NuGet Package: DevExpress.Wpf.SpellChecker

#Declaration

public static class SpellingExtensions

#Remarks

The SpellingExtensions class provides extensiton methods used to retrieve SpellChecker error commands.

The GetErrorOperationCommands method creates a list of SpellChecker commands. The list depends on the type of misspelling and current spellchecker operation mode.

Use the GetSpellCheckError method to invoke a custom context menu for misspelled words, as shown below:

void RichTextBox_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
    MenuItems.Clear();
    var commands = this.richTextBox.GetErrorOperationCommands(e.GetPosition(this.richTextBox));
    foreach (var command in commands)
    {
        var menuItem = new MenuItem();
        menuItem.Header = command.Caption;
        menuItem.Click += (s, args) => command.DoCommand();
        menuItem.IsEnabled = command.Enabled;
        MenuItems.Add(menuItem);
    }
    if (MenuItems.Count == 0)
        MenuItems.Add(new MenuItem() { Header = "No Error", IsEnabled = false });
}

#Inheritance

Object
SpellingExtensions
See Also