Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

IAutoCorrectService Interface

Defines a service that performs auto correction.

Namespace: DevExpress.XtraRichEdit.Services

Assembly: DevExpress.RichEdit.v20.2.Core.dll


public interface IAutoCorrectService


The IAutoCorrectService service calls the IAutoCorrectProvider.CalculateAutoCorrectInfo methods of registered providers in a predefined order to obtain an AutoCorrectInfo object. Then, this object is used to perform a replacement.

You can easily add your own table-based autocorrect functionality.

For this, use the GetService method of a control to obtain the IAutoCorrectService. Then, create an AutoCorrectReplaceInfoCollection instance, fill it with pairs from your custom autocorrect table and use the IAutoCorrectService.SetReplaceTable method to register your table for use by the service.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.Services;
            IAutoCorrectService svc = richEditControl1.GetService<IAutoCorrectService>();
            if (svc != null)
        private AutoCorrectReplaceInfoCollection LoadAbbrevs(string path)
            AutoCorrectReplaceInfoCollection coll = new AutoCorrectReplaceInfoCollection();
            string aLine = "";

            AutoCorrectReplaceInfo acrInfoIm = new AutoCorrectReplaceInfo(":-)", CreateImageFromResx("smile.png"));

            if (File.Exists(path))
                StreamReader sr = new StreamReader(path);
                while (!(sr.EndOfStream))
                    aLine = sr.ReadLine();
                    if (aLine != "START") continue;

                    while (!(sr.EndOfStream))
                        aLine = sr.ReadLine();
                        aLine = aLine.Trim();
                        string[] words = aLine.Split('=');
                        if (words.Length == 2)
                            AutoCorrectReplaceInfo acrInfo = new AutoCorrectReplaceInfo(words[0], words[1]);
            return coll;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IAutoCorrectService interface.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also