Question

I want to create a photo gallery basically. I have a list of x items, and a pivot of 3 pages fixed. (I did this because I don't know in advance will I have 4 items or 1000)

When I'm browsing between the items and I reach the last one, I want to disable further paging to the right, or to the left if I reached the begining.

Is this possible, and how?

Thanks in advance.

Was it helpful?

Solution

You can use my answer here to determine when the user is on the first or last pivot item. Once you reach the the first or last pivot page, you can then disable the hit testing by using IsHitTestVisible=false as described on this page. To ensure that you can still swipe in the opposite direction, you can detect a horizontal swipe to the left to re-enable it and then manually move the pivot using SelectedIndex.

There are various ways of detecting a horizontal swipe such as using the gesture library or calculating it manually. You can get the starting position and the final position of the user's touch and determine if the difference in the X positions is positive (swiped to the right) or negative (swiped to the left) - assuming you're subtracting the initial position from the final one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top