SpellingExtensions.GetErrorOperationCommands(DependencyObject, Point) Method
In This Article
Creates a list of commands available for the misspelled or repeatedword at the specified point in the given editor.
Namespace: DevExpress.Xpf.SpellChecker
Assembly: DevExpress.Xpf.SpellChecker.v24.2.dll
NuGet Package: DevExpress.Wpf.SpellChecker
#Declaration
public static IEnumerable<SpellCheckerCommand> GetErrorOperationCommands(
this DependencyObject editor,
Point point
)
#Parameters
Name | Type | Description |
---|---|---|
editor | Dependency |
A target editor. |
point | Point | A point in the editor the misspelled or repeated word occupies. |
#Returns
Type | Description |
---|---|
IEnumerable<Spell |
A list of error commands available for the target word. |
#Remarks
The returned list depends on the type of misspelling and current spellchecker operation mode.
Use the GetSpellCheckError method to invoke a custom context menu for misspelled or repeated 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 });
}
See Also