Access the RichEditControl

This topic describes how to access and customize the RichEditControl object in XAF applications when the Office Module is used. The steps below demonstrate how to enable Spell Checking. However, you can use a similar approach for other customizations.

  • Create a custom View Controller in a WinForms module project.
  • Add the DevExpress.SpellChecker.v18.2.dll and DevExpress.XtraSpellChecker.v18.2.dll assemblies to the project references.
  • Override the OnActivated method and handle the RichTextServiceController.Controller_CustomizeRichEditControl event. In the event handler, create and setup the SpellChecker object and pass this object to the SpellChecker property.

    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Office.Win;
    using DevExpress.XtraRichEdit;
    using DevExpress.XtraSpellChecker;
    public partial class CustomRichTextController : ViewController {
    // ...
        protected override void OnActivated() {
            RichTextServiceController controller = Frame.GetController<RichTextServiceController>();
            if(controller != null) {
                controller.CustomizeRichEditControl += Controller_CustomizeRichEditControl;
        private void Controller_CustomizeRichEditControl(object sender, CustomizeRichEditEventArgs e) {
            SpellChecker spellChecker = new SpellChecker();
            spellChecker.SetSpellCheckerOptions(e.RichEditControl, new OptionsSpelling());
            spellChecker.SpellCheckMode = SpellCheckMode.AsYouType;
            e.RichEditControl.SpellChecker = spellChecker;

The Spell Checker uses the English dictionary by default. Refer to the Dictionaries topic to see how to change the dictionary.