6

Is it possible to use TextBox in "virtual" mode.

I want to supply text on demand, when user scrolls through the document.

Konstantin Spirin
  • 20,609
  • 15
  • 72
  • 90

2 Answers2

1

To use the built in virtualization (i.e. VirtualizingStackPanel used by default ListBox) you need to be able to chunk the content into items which can be progressively loaded one at a time as needed (logical scrolling). To do this for arbitrary large text would involve a lot of pre-processing to calculate line wrapping and break the text up into lines or groups of lines. Once you do that you would need to use a container derived from ItemsControl instead of a single TextBox. Do you have a requirement to have editable text?

John Bowen
  • 24,213
  • 4
  • 58
  • 56
0

I thought virtual mode was intended to speed up application performance by only getting and rendering data on demand. If the user is scrolling through the document, doesn't that imply that the data is already loaded? Couldn't you databind the TextBox to a property in code-behind and merely set the value of that property while the user is scrolling?

Dave
  • 14,618
  • 13
  • 91
  • 145
  • For example, only first page of data is loaded. When user scrolls down I want text box to ask me for the second page and I'll provide it. – Konstantin Spirin Feb 23 '10 at 05:11
  • ah, I see what you mean. like how websites dynamically load content once the first page is viewed by scrolling to the bottom. time to star this question! :) – Dave Feb 23 '10 at 13:45
  • "only getting and rendering data on demand" is Data Virtualization. "getting all but only rendering some data on demand" is what we need most of the time (UI Virtualization) – fjch1997 Aug 09 '17 at 01:10