how to handle pivot swipe gesture through button c

2019-09-25 13:32发布

How to swipe images through button click event just like windows phone Gallery Photo(left to right or vice verse,use 2 button "<" and ">").I have use pivot control to swipe images one by one & list box to collect all images.It is working fine for swipe(touch) gesture.

1条回答
男人必须洒脱
2楼-- · 2019-09-25 14:29

you can easily achieve this via setting the Pivot.SelectedIndex

like

for forward

if(Pivot.selectedIndex < Pivot.Items.Count)
    Pivot.selectedIndex++;
else
    Pivot.selectedIndex = 0;

for backward

if(Pivot.selectedIndex > 0)
    Pivot.selectedIndex--;
else
    Pivot.selectedIndex = Pivot.Items.Count - 1;
查看更多
登录 后发表回答