Answer the question
In order to leave comments, you need to log in
How to determine that an element is in the workspace?
Let's say we have a ScrollViewer. Maybe an expander. Yes, anything that can hide the control. How do I determine that an element is currently displayed on the screen and visible to the user?
If this is not possible, then I will briefly describe the problem to which I have found only one solution so far.
There is a TreeView. I am loading data into it. Lots of data. Data is read from the database in 50 rows. When the last item out of those 50 is added to the tree, I want to subscribe to an event that will happen when that item is displayed on the screen.
At first I thought to use scroll events, but it’s not a fact that the element I need will be at the end of the list, tree elements have descendants. And they also need to be loaded gradually
Nothing else comes to mind, unfortunately.
Answer the question
In order to leave comments, you need to log in
I didn't do the loading by scrolling, but it seems that in winforms it was called virtual mode.
Try looking at the links:
www.codeproject.com/Articles/42110/Virtual-Mode-Tr...
stackoverflow.com/questions/27508470/how-to-solve-...
You
might also want to google lazy loading and choose a solution that will suit you.
Search keyword treeview virtualization wpf
MSDN has a dedicated article: Improving TreeView Performance
In general, in WPF with data virtualization, everything is rather sad. Due to its absence, so many third-party grids have bred. But nevertheless, you can subscribe to the events of the ItemContainerGenerator, which is responsible for visual virtualization, and load data when the string container appears on the screen.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question