silverlightsilverlight-4.0

Textbox scrolling is too slow with a reasonably big text in it - anything to be done about it?


When I load around 100KB text in TextBox it begins to work really laggy. Like scrolling it, etc. It just feels bad.

Is there any reasonably easy workaround around it?

I'd like to be able to load something up to a megabyte of text without huge lag in scrolling.

On top of scrolling there are problems with selecting text or editing it, it becomes very slow and uncomfortable too.


Solution

  • The TextBox doesn't have virtualization, and so isn't really designed to support large amounts of text. You will need to use a different kind of control, and possibly think about whether your expanse of text really needs to be just a single string: could it be broken down into smaller objects that make sense?

    RichTextBox, ListBox or DataGrid are all good candidates for the kind of control you should be using - depending on what you want to do and how much you can break up the text into parts.