I have a long page with a ScrollViewer
(like web-page).
Page contains header and list of lazy loading infinite scrolling content. Header should scroll away with list content. Header height is 5 times larger than list item height.
Is there any good way to virtualize this?
<ScrollViewer>
<StackPanel>
<TextBlock Text="Header:" />
<StackPanel Orientation="Horizontal" Height="500">
<!--Complex UI-->
</StackPanel>
<TextBlock Text="Videos:"/>
<ItemsControl ItemsSource="{Binding Videos}"
ItemsTemplate="{StaticResource VideoDataTemplate}" />
</StackPanel>
</ScrollViewer>
What I've tried:
- Make
DataTemplateSelector
for header/list item and put everything into oneItemsControl
. Reason: ScrollViewer withCanContentScroll="True"
scrolls header away on first scroll tick. This is not acceptable because header is too large. - Make two
ScrollViewers
. One for header with large bottom margin, one for items with header height top margin. Reason: Too hard to sync top offset and mouse events.