【Windows phone 8】欢迎引导页面02
【目标】前一篇文章已经实现了图片的切换,这里需要限制pivot的循环滚动。
【思路】通过手势事件,对第一张,最后一张图片处加以限制
【前台】
在pivot处加上
<toolkit:GestureService.GestureListener> <toolkit:GestureListener DragDelta="GestureListener_DragDelta_1" DragCompleted="GestureListener_DragCompleted_1" /> </toolkit:GestureService.GestureListener>
【后台】
private void GestureListener_DragCompleted_1(object sender, DragCompletedGestureEventArgs e) { if ((this.imagePivot.SelectedIndex == ellipses.Count - 1 && e.HorizontalChange < 0) || (this.imagePivot.SelectedIndex == 0 && e.HorizontalChange > 0)) { this.imagePivot.IsLocked = true; } } private void GestureListener_DragDelta_1(object sender, DragDeltaGestureEventArgs e) { if ((this.imagePivot.SelectedIndex == ellipses.Count - 1 && e.HorizontalChange > 0) || (this.imagePivot.SelectedIndex == 0 && e.HorizontalChange < 0)) { this.imagePivot.IsLocked = false; } }
请注明文章出处[http://www.cnblogs.com/fb-boy/]