Skip to main content

ASPxSpellChecker.CustomDictionaryLoading Event

Fires when a custom dictionary is loading into a session.

Namespace: DevExpress.Web.ASPxSpellChecker

Assembly: DevExpress.Web.ASPxSpellChecker.v24.2.dll

Declaration

public event CustomDictionaryLoadingEventHandler CustomDictionaryLoading

Event Data

The CustomDictionaryLoading event's data class is CustomDictionaryLoadingEventArgs. The following properties provide information specific to this event:

Property Description
CustomDictionary Gets the custom dictionary to be loaded.

Remarks

Handle the CustomDictionaryLoading event and use the ASPxSpellCheckerCustomDictionary.LoadFromStream method to load a custom dictionary, other than the default.

To save a custom dictionary when a word is added to it, handle the ASPxSpellChecker.WordAdded event.

The following code snippet illustrates that you can handle the ASPxSpellChecker.CustomDictionaryLoading event to load a custom dictionary from a stream. Note that the ASPxSpellChecker control already has an ASPxSpellCheckerCustomDictionary object in its collection of dictionaries. When the custom dictionary is loading, it fires an event allowing you to load a user-specific dictionary.

View Example

using DevExpress.Web.ASPxSpellChecker;
using DevExpress.XtraSpellChecker;
        protected void ASPxSpellChecker1_CustomDictionaryLoading(object sender, CustomDictionaryLoadingEventArgs e) {

            FileStream alphStream = new FileStream(Server.MapPath(e.CustomDictionary.AlphabetPath), FileMode.Open, FileAccess.Read);
            FileStream dicStream = new FileStream(userDictPath, FileMode.OpenOrCreate, FileAccess.Read);
            try {
                alphStream.Seek(0, SeekOrigin.Begin);
                dicStream.Seek(0, SeekOrigin.Begin);
                e.CustomDictionary.LoadFromStream(dicStream, alphStream);
            }
            finally {
                alphStream.Dispose();
                dicStream.Dispose();
            }
        }
See Also