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

RadRichTextBox, SpellCheck and MEF

1 Answer 145 Views
SpellChecker
This is a migrated thread and some comments may be shown as answers.
SHAWN
Top achievements
Rank 1
SHAWN asked on 18 Jul 2011, 10:02 PM
In my project we are using XAP partitioning (using something similar to what Glen Block describes in his article). My main XAP has my menu, then depending on security permissions I download module XAP's that contain modules of application. One of those sections needs a RadRichTextBox. In an effort turn on the spell check feature we added the dll for the dictionary (Telerik.Windows.Documents.Proofing.Dictionaries.En-US) to the module XAP, however the spell check did not work. In a game of trial and error I added it to the main XAP, and everything worked fine. However I don't want to weigh down my main XAP with stuff for one of the modules, that possibly the user will never need. Any ideas if I need to do something special to get MEF to load the spell check dictionary with it is in the module XAP?

1 Answer, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 22 Jul 2011, 11:06 AM
Hello Shawn Weisfeld,

In the 2011 Q2 release we introduced the RadCompositionInitializer class which aims to give more control over the MEF composition that is done under the hood of the RadRichTextBox control. The RadCompositionInitializer class is used to satisfy all the imports in the rich text box. It uses shared CompostionContainer that is available statically through the RadCompositionInitializer.Container property. In scenarios like yours you can replace the default container that is created with you own that is more suited to you needs.

What we don't support at this moment is a way to force recomposition. This means that once the spell-checker loads its dictionaries once, there is no way to force him to check whether there are new dictionaries available  in the composition container. Fortunately there are workarounds to this problem. One option is to create a new instance of DocumentSpellCheker class and assign it to the SpellChecker property of the RadRichTextBox. The new instance will automatically discover and use all the dictionaries that are available. Another option is to create an instance of the dictionary and add it manually to the current spell checker. Here is how this can be done:
((DocumentSpellChecker)this.radRichTextBox.SpellChecker).AddDictionary(dictionary, new CultureInfo("en-US"));

I hope this is helpful. You can also check out this article (again by Glenn) where the application partitioning is implemented with the use of DeploymentCatalog.
Please don't hesitate to get back to us if you have more questions.

Best wishes,
Alex
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
SpellChecker
Asked by
SHAWN
Top achievements
Rank 1
Answers by
Alex
Telerik team
Share this question
or