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

RadSpellChecker on TextBox gives error no spell check for this type of control.

4 Answers 123 Views
SpellChecker
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 28 Aug 2012, 04:02 PM
I am using a simple textbox.  When I try to implement the RadSpellChecker on it, as in the examples, it gives me an error that there is no spell check for this type of control.

I saw the older forum entry someone posted a while back, but my scenario is not the same.  I am using a basic standard textbox and I do not have 'Reduce XAP size..." enabled in my project.

Here is my XAML Code:
<TextBox x:Name="txtNotes" Width="520" Height="25" MaxLength="150" />

And here is my C#:
private void rbtnSpellCheck_Click(object sender, RoutedEventArgs e)
{
     RadSpellChecker.Check(txtNotes, SpellCheckingMode.WordByWord);
}

See, pretty straight forward... hopefully the solution to whatever is causing me the issue is easy too :)

4 Answers, 1 is accepted

Sort by
0
Stephen
Top achievements
Rank 1
answered on 28 Aug 2012, 04:39 PM
True to form I guess.  I work on this for a handful of hours.  Then I decide it is time to post the issue in the forums and then figure out the solution shortly after I decide to post it.

Just in case anyone wants to know what else I had to do, here in the code that I added after InitializeComponent():

ControlSpellCheckersManager.RegisterControlSpellChecker(new TextBoxSpellChecker());
var _ControlSpellchecker = ControlSpellCheckersManager.GetControlSpellChecker(typeof(TextBox));
var _SpellChecker = _ControlSpellchecker.SpellChecker;
var _DocumentSpellChecker = (DocumentSpellChecker) _SpellChecker;
_DocumentSpellChecker.SpellCheckingCulture = new CultureInfo("en-US");
_DocumentSpellChecker.AddDictionary(new RadEn_USDictionary(), new CultureInfo("en-US"));

Hopefully I did it right.
0
Andrew
Telerik team
answered on 30 Aug 2012, 01:38 PM
Hello Stephen,

We are glad you managed to solve your problem. Those ControlSpellCheckers are supposed to be loaded automatically through MEF. This is why when you use "Reduce XAP size..." or you inherit from TextBox class those spellcheckers are not loaded. 
Apparently in your case something else is causing it. What the code you wrote does is just manually load the desired ControlSpellChecker.

Just one more thing. If you want to use SpellCheckAllAtOnce window you have to register the RadRichTextBoxSpellChecker too, because no matter what control you spellcheck - it is the one used.

All the best,
Andrew
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vit100
Top achievements
Rank 1
answered on 09 Nov 2012, 05:16 PM
Let me add one more important point to Andrew's post:

Don't forget to register  dictionary itself in control constructor/or somewhere
  RadCompositionInitializer.Catalog = new TypeCatalog( 
   typeof(RadEn_USDictionary) 
);

Otherwise you will be able to spellcheck textBox, but no dictionary loaded, so everything is miss-spelled.
0
Patrick
Top achievements
Rank 1
answered on 01 Mar 2013, 12:01 AM
Vit100,

This worked great for us. Since we switched to using MEF our dictionary was always empty. Simply adding a new instance of TypeCatalog in our MainPage constructor did it without the need to manipulate the DocumentSpellChecker of our controls. Thank you.

-Patrick
Tags
SpellChecker
Asked by
Stephen
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 1
Andrew
Telerik team
Vit100
Top achievements
Rank 1
Patrick
Top achievements
Rank 1
Share this question
or