2

My program requires loading a large set of images within one scrollable view (around 1K)
My code:

<ScrollViewer>
    <VirtualizingStackPanel Orientation="Vertical"> <!-- Stack panel of stack panels -->
        <StackPanel Orientation="Horizontal">
            <local:Widget Text="1" Image="https://exaple.com/" /> <!-- local class purpose of is placing image and text in one line -->
            <local:Widget Text="1" Image="https://exaple.com/" />
            <local:Widget Text="1" Image="https://exaple.com/" />
        </StackPanel>
        <StackPanel Orientation="Horizontal">
            <local:Widget Text="1" Image="https://exaple.com/" />
            <local:Widget Text="1" Image="https://exaple.com/" />
            <local:Widget Text="1" Image="https://exaple.com/" />
        </StackPanel>
        ...
    </VirtualizingStackPanel>
</ScrollViewer>

Problem is that before launching wpf goes to every website and downloads all images at once, how can I say wpf to download and show them on user seeing them?

---- EDIT

I have pinpointed the issue with scrollviewer demanding everything all at once, either I use CanContentScroll or not, I also tried using ListBox with VirtualizingPanel.ScrollUnit="Pixel", but it also did not work, still looking for answer

Ozballer31
  • 413
  • 1
  • 5
  • 14

1 Answers1

0

After about 7 hours of pure hell I did it (I mean I did find it)
Loading a large amount of images to be displayed in a WrapPanel
Without cache and other not so important for me classes I found a ScrollViewer implementation that checks every on every scroll changed if any StackPanel's are in the view and with DataTrigger it changes to whatever you want it to, and as much as I like this answer the more I hate how things works) Hope I'll help anyone

Ozballer31
  • 413
  • 1
  • 5
  • 14