How to: Register Custom Control to Enable Spell Checking
The following example describes how to implement the spell checker in custom or standard text controls (TextBox or RichTextBox).
#Register Standard Text Control
In XAML, configure the text control’s DXSpellChecker behavior.
xmlns:mvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/spellchecker"> <TextBox TextWrapping="Wrap" Text="TextBox" Grid.Column="1"> <mvvm:Interaction.Behaviors> <dxsch:DXSpellChecker CheckAsYouType="True" ShowSpellCheckMenu="True" Culture="en-US"/> </mvvm:Interaction.Behaviors> </TextBox>
In code-behind, register the control by calling the SpellingSettings.RegisterTextControl method.
#Register the RichEditControl descendant
In XAML, configure the custom control’s RichEditSpellChecker behavior.
xmlns:mvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/spellchecker"> <mvvm:Interaction.Behaviors> <dxsch:RichEditSpellChecker CheckAsYouType="True" ShowSpellCheckMenu="True" Culture="en-US"/> </mvvm:Interaction.Behaviors>
To enable the Spelling dialog for the custom control, call the SpellCheckTextControllersManager.Default.RegisterClass method. This method requires the DevExpress.XtraSpellChecker.Native namespace reference. Call the SpellCheckTextBoxBaseFinderManager.Default.UnregisterClass method to disable spelling check.