Skip to main content

SpellCheckOptions.MaxSuggestionCount Property

Specifies the maximum number of suggestions the context menu should display.

Namespace: DevExpress.Blazor.RichEdit.SpellCheck

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

[DefaultValue(5)]
public int MaxSuggestionCount { get; set; }

Property Value

Type Default Description
Int32 5

The maximum number of suggestions.

Remarks

The built-in spell check service uses dictionaries to generate a spelling suggestion list. The Rich Text Editors displays the suggested words and phrases in the context menu. When the service generates no suggestions, the context menu displays No suggestions.

The context menu can display up to 15 suggestions. The MaxSuggestionCount property specifies the maximum number of suggestions the context menu should display. For instance, if you set this property to 3, the context menu displays up to 3 suggestions. If the service generates more than 3 suggestions, the context menu displays only the first 3 suggestions.

The following code snippet sets the maximum number of suggestions:

public void ConfigureServices(IServiceCollection services) {
    services.AddDevExpressBlazor().AddSpellCheck(opts => {
        opts.FileProvider = new PhysicalFileProvider(
            Path.Combine(Directory.GetCurrentDirectory(), "Data", "Dictionaries")
        );
        opts.MaxSuggestionCount = 7;
        opts.Dictionaries.Add(new Dictionary {
            DictionaryPath = "CustomEnglish.dic",
            AlphabetPath = "EnglishAlphabet.txt",
            Culture = "en-US"
        });
        opts.AddToDictionaryAction = (word, culture) => {
            switch (culture.Name) {
                case "en-US":
                    string path = opts.FileProvider.GetFileInfo("CustomEnglish.dic").PhysicalPath;
                    File.AppendAllText(path, word);
                    break;
                default:
                    break;
            };
        };
    });
}

Refer to the following topic for more information: Spell Check.

See Also