I have a listBox, which I am trying to bind to an IList collection using ItemsSource. My problem scenario comes when each of my person object has a FlowDocument which I am trying to display in a richTextBox within the listBoxItem.
Imagine the performance degradation, when there are 1000 person objects,
Is there a way, I get to dynamically load the flowDocument / RichTextbox so that there is no performance impact.
Is there a way, I get to know which Items of the listbox are visible at any moment in time so that, I can dynamically bind the richtextbox with the flow document and when the scroll happens, I can clear the previous binding and apply binding to only those items that are visible.
<ListBox ItemsSource="{Binding PersonsCollection">
<ListBox.ItemTemplate>
<DataTemplate>
<RichTextBox Document="{Binding PersonHistory}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
thanks
public class Person
{
public FlowDocument PersonHistory{get;set}
}