Windows Phone 7 & 8, Listbox: How to detect compression (end of scroll) states ?

I was looking to the right way of detecting when the user reach the end of scroll in a listbox to load some more data and I found many solution based on the scrollviewer offset but I didn’t like it. At the end I came on this article with a really clean solution to the problem.

Basically the solution is to add two new states to the original template:

                                <VisualStateGroup x:Name="VerticalCompression"> 
                                    <VisualState x:Name="NoVerticalCompression"/> 
                                    <VisualState x:Name="CompressionTop"/> 
                                    <VisualState x:Name="CompressionBottom"/> 
                                <VisualStateGroup x:Name="HorizontalCompression"> 
                                    <VisualState x:Name="NoHorizontalCompression"/> 
                                    <VisualState x:Name="CompressionLeft"/> 
                                    <VisualState x:Name="CompressionRight"/> 


Ultimi Post


Articles and content of this blog aren't and shouldn't be interpreted as professional advice or opinions. Author writes on a personal basis and as part of their own research, experimentation and knowledge. Opinions expressed aren't in any way attributable to professional affiliations / institutional thereof or to opinions that the author express as part of their roles / positions that may be quite different from that reported here.