This is a migrated thread and some comments may be shown as answers.

Error: No spellcheck for this type of control.

1 Answer 147 Views
SpellChecker
This is a migrated thread and some comments may be shown as answers.
redstar
Top achievements
Rank 1
redstar asked on 14 Apr 2011, 07:48 AM
when check the TextBox, an error happen says:No spellcheck for this type of control.
please help me.

RadSpellChecker.Check(this.tbxMultiRow, SpellCheckingMode.AllAtOnce);

1 Answer, 1 is accepted

Sort by
0
Andrew
Telerik team
answered on 15 Apr 2011, 08:25 AM
Hello redstar,

RadSpellChecker internally holds a dictionary matching a Type to an instance of a class deriving from IControlSpellChecker. This dictionary is filled through MEF, as it searches the available assemblies for implementations of this interface marked with the [Export(typeof(IControlSpellChecker))] attribute, instantiates them and adds them to the dictionary mentioned above. The error message you got displays when MEF haven't loaded an IControlSpellChecker for your control. Which leads to two reasons for your exception:
1) Your control is not supported by default (TextBox, RichTextBox and RadRichTextBox). In this case you have to supply an implementation of yours for IControlSpellChecker or SpellCheckerBase(an abstract class implementing IControlSpellChecker) and mark it with the export attribute above.
2) You have enabled "Reduce XAP size by using application library caching" option in Project Properties(Silverlight tab). If this is the case then you have to register the corresponding IControlSpellChecker for the control you wish to use, by hand. You can use the following code before calling RadSpellChecker.Check method:

ControlSpellCheckersManager.RegisterControlSpellChecker(new TextBoxSpellChecker());  
IControlSpellChecker controlSpellchecker = ControlSpellCheckersManager.GetControlSpellChecker(typeof(TextBox));  
ISpellChecker spellChecker = controlSpellchecker.SpellChecker;  
DocumentSpellChecker documentSpellChecker = (DocumentSpellChecker)spellChecker;  
documentSpellChecker.AddDictionary(new RadEn_USDictionary(), new System.Globalization.CultureInfo("en-US"));

This is in case you want to spell check a TextBox with en-US culture. If you need to spell check other control please provide its implementation as argument to the ControlSpellCheckersManager.RegisterControlSpellChecker method. If you want to spell check a different culture replace the RadEn_USDictionary class with another one matching your preference.

All the best,

Andrew
the Telerik team

 

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
SpellChecker
Asked by
redstar
Top achievements
Rank 1
Answers by
Andrew
Telerik team
Share this question
or