1

I need to add spell checker text control (either textbox control or richtextbox control) in my silveright 4(out of browser in elevated trust mode) application. My application can have more than 500 editing control loaded. It works fine with textbox control but it does not have spell cheking facility. Using RichTextBox lead to System out of memory exception.

Please suggest what should I do to use RichTextBox withoug system out of memory exception. any other alternative is welcome...

Regards

Maddy

Maddy
  • 41
  • 3
  • Why are you loading 500 editing controls? There is no way that is ever going to work smoothly. I would suggest changing your approach and only loading the RichTextBox for the text that is actually being edited instead of loading them all at once. – Henrik Söderlund Dec 20 '12 at 09:21
  • Actually I have a report that contains 250 questions and we can not show this using paging(that would have been the good approch to display 10-20 question at a time) (as per client requirement). If each question have two editing control then it lead to 500 controls for a single report. – Maddy Dec 20 '12 at 09:59
  • Ok, so the actual _questions_ are being displayed in one RichTextBox each? And then there is a comment box attached to each of these questions? Am I understanding you correctly? – Henrik Söderlund Dec 20 '12 at 10:16
  • Yes. you are getting right – Maddy Dec 21 '12 at 06:50
  • Do you need the rich text functionality of the RichTextBox component? Or did you use that merely because you need spell checking? Also, which spell checking component are you using? – Henrik Söderlund Dec 21 '12 at 09:15

1 Answers1

1

Here are two ideas:

1. Use a spell checker that can be connected to a normal TextBox
If you do not need the rich text functionality, use (for example) the spell checker component from the Telerik RadControls suite. It can be attached to a normal TextBox as well as RichTextBox, as in this demo: http://demos.telerik.com/silverlight/#SpellChecker/TextBoxes. It is not free though.

2. Use a VirtualizingStackPanel to hold the questions/comments
If you do need rich text, you must change your approach. It is just not possible to load that many in one go in Silverlight. One option is to use a VirtualizingStackPanel to hold the RichTextBox components. This way, only the controls that are visible in the page will actually be loaded. The problem with this approach is that each question/comment section must have a fixed height. Check out the code example posted in this question:
Getting UI virtualization working with ItemsControl in Silverlight

Community
  • 1
  • 1
Henrik Söderlund
  • 4,286
  • 3
  • 26
  • 26
  • I have gone through the first option (Use a spell checker that can be connected to a normal TextBox) but it will require a button on each text box and don't show the zig-zag line below the wrong word and as far as 2nd option is concerned the radrichtextbox continue to occupy memory even if the control is not displayed on the screen. My applicaiton started with 100 MB memory and it gradually reached to 1.2 GB after scrolling up n down the application :( – Maddy Dec 24 '12 at 06:18