I have a form with multiple rich text editors, all with custom spell checking.
I did have this code to set the spell checker:
However, I found that I was using hundreds of megabytes of memory.
The work-around I used was to create a custom document spell checker:
I then assigned the custom spell checker to the rich text editor:
I'm hoping this approach is reasonable, and that the spell checker won't have a problem with being assigned to multiple rich text editors.
I did have this code to set the spell checker:
System.InvalidOperationExceptionvar culture = CultureInfo.GetCultureInfo(
"en-AU"
);
var checker = (DocumentSpellChecker)radRichTextEditor1.SpellChecker;
if
(!(checker.GetDictionary(culture)
is
AustralianDictionary))
{
checker.AddDictionary(AustralianDictionary.Instance, culture);
}
radRichTextEditor1.SpellChecker.SpellCheckingCulture = culture;
However, I found that I was using hundreds of megabytes of memory.
The work-around I used was to create a custom document spell checker:
public
class
CustomDocumentSpellChecker : DocumentSpellChecker
{
// Singleton pattern: http://msdn.microsoft.com/en-au/library/ff650316.aspx
// Thread-safe thanks to the CLR
private
static
readonly
CustomDocumentSpellChecker _instance =
new
CustomDocumentSpellChecker();
private
CustomDocumentSpellChecker()
{
var culture = CultureInfo.GetCultureInfo(
"en-AU"
);
AddDictionary(AustralianDictionary.Instance, culture);
SpellCheckingCulture = culture;
}
public
static
CustomDocumentSpellChecker Instance
{
get
{
return
_instance;
}
}
}
I then assigned the custom spell checker to the rich text editor:
radRichTextEditor1.SpellChecker = CustomDocumentSpellChecker.Instance;
I'm hoping this approach is reasonable, and that the spell checker won't have a problem with being assigned to multiple rich text editors.