Back to Devexpress

How to: Enable Spelling Check-As-You-Type for the Rich Edit Control

wpf-8937-controls-and-libraries-spell-checker-examples-how-to-enable-spelling-check-as-you-type-for-the-rich-edit-control.md

latest2.2 KB
Original Source

How to: Enable Spelling Check-As-You-Type for the Rich Edit Control

  • Jul 26, 2024

This example describes how to enable check-as-you-type mode in the RichEditSpellChecker and SpellChecker objects.

Enable Check-As-You-Type Mode in RichEditSpellChecker

Use the RichEditSpellChecker.CheckAsYouType property to enable the check-as-you-type mode.

Set the DXRichEditSpellCheckerOptions.AutoDetectDocumentCulture property to true to make the RichEditControl detect the text language automatically.

Note

Consider the following limitations:

  • You cannot change the color (red) or appearance (wavy) of the underline used in the RichEditControl.

  • A custom dictionary specified in XAML does not save words that users add at runtime.

  • XAML

xaml
<dxre:RichEditControl x.Name="richEditControl">
    <dxre:RichEditControl.SpellCheckerOptions>
        <dxre:DXRichEditSpellCheckerOptions AutoDetectDocumentCulture="True"/>
</dxre:RichEditControl.SpellCheckerOptions>
    <dxmvvm:Interaction.Behaviors>
        <dxspch:RichEditSpellChecker CheckAsYouType="True"
                                        Culture="en-US"
                                        IgnoreMixedCaseWords="False"
                                        IgnoreUri="False"
                                        SpellingFormType="Word"/>

Enable Check-As-You-Type Mode in a Standalone SpellChecker

The RichEditControl.SpellChecker property allows you to obtain the ISpellChecker instance at runtime. Use the SpellChecker.SpellCheckMode property to enable the mode.

csharp
using DevExpress.XtraSpellChecker;
//...
richEdit.SpellChecker.SpellCheckMode = SpellCheckMode.AsYouType;
vb
Imports DevExpress.XtraSpellChecker
'...
richEdit.SpellChecker.SpellCheckMode = SpellCheckMode.AsYouType