加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-store-apps – 如何使用滑动动画以编程方式在FlipView中

发布时间:2020-12-14 04:18:19 所属栏目:Windows 来源:网络整理
导读:Windows开发人员中心说明了UseTouchAnimationsForAllNavigation属性: The XAML FlipView control supports three modes of navigation; touch-based,button-based and programmatic. When a user navigates by touch,the FlipView items scroll smoothly in
Windows开发人员中心说明了UseTouchAnimationsForAllNavigation属性:

The XAML FlipView control supports three modes of navigation; touch-based,button-based and programmatic. When a user navigates by touch,the FlipView items scroll smoothly into view. When you set this property to true,the same navigation animation occurs whether the navigation is touch-based,button-based and programmatic.

我正在通过分配FlipView的SelectedItem属性从我的页面代码导航:

FlipView.SelectedItem = FlipView.Items.Last();

但是,滑动动画不会显示.我该如何启用它?

与此同时,我能够解决这个问题.我有一个按钮,触发导航到下一个FlipViewItem.然而,此按钮被放置在FlipViewItem中.

使用我的设置(触摸设备),没有任何事情发生.然后我尝试用鼠标点击按钮,它工作.禁用UseTouchAnimationsForAllNavigation后,它也可以使用触摸输入.在我的测试中,我将按钮放在FlipView之外,它确实可以使用动画.

这是问题:点击按钮时,导航动画尝试启动(SelectedIndex设置正确),但因为用户仍然按下按钮来阻止动画,因此停止了.因此,导航被取消,SelectionChanged报告当前页面.

解决方案是将Button的ManipulationMode设置为All.之后,您无法在触摸按钮时翻转FlipViewItem,但动画会执行并且它会像魅力一样工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读