I have a FlowDocument
with much content inside. I need to get the controls that are currently in the visible area.
With the following code I was able to get the current scrolling Position.
DependencyObject obj = FlowDocumentScrollViewerCtrl;
do
{
if (VisualTreeHelper.GetChildrenCount(obj) > 0)
{
obj = VisualTreeHelper.GetChild(obj as Visual, 0);
}
}
while (!(obj is ScrollViewer));
ScrollViewer sv = obj as ScrollViewer;
How can I get the controls within the visible area?
Thanks Ray for your answer. I followed your tips in some points yesterday and thats the working code for my problem:
I use a register function for the elements of interest and working only on them. The zoom is only neccessary for a FlowDocument I think. This code should work on every control which uses a ScrollViewer. I would appreciate if anyone may comment this if this is a practical solution.