Tuesday, August 28, 2012

Visual effect occuring when ListBox reach the boundary

Visual effect occuring when ListBox reach the boundary

Is it possible to get an event that determines the moment when ListBox (Windows Phone, Windows 8) Control reach to one of boundary. There is a characteristic visual effect, something like squeezing

Answers & Comments...

Answer: 1

Here is a sample written for Windows Phone 7. It allows you to see when the user has reaches the start/end of the list.

by : Shawn Kendrothttp://stackoverflow.com/users/1054961

Answer: 2

You will first need to access the ScrollViewer for the ListBox. Once you have the ScrollViewer you will want to subscribe to the ViewChanged event. When that event fires, you can check the VerticalOffset property and compare it to the ScrollableHeight property. That should tell you whether your at the top or bottom of the scroll.

There are a number of ways to get to the ScrollViewer. Inheriting your own control and overriding OnApplyTemplate is one, but using VisualTreeHelper is probably easier. Here's an article that shows how:

http://developingfor.net/2009/02/16/fun-with-the-wpf-scrollviewer/

by : Jared Bienz - MSFThttp://stackoverflow.com/users/59793




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog