ListView 项目选择 Windows 应用商店 [英] ListView Item Selection Windows Store

查看:39
本文介绍了ListView 项目选择 Windows 应用商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 ListView 的行为如下:

I want a ListView to behave like this:

使用鼠标输入:

  • 左键单击 -> 项目单击事件处理程序被执行,但不应该将其显示为已选择"
  • 右键单击 -> 项目被选中

触摸输入:

  • 单击 -> 相当于左键单击
  • 向下滑动 -> 相当于右键单击

我尝试过各种事件和设置,但似乎无法正常工作.

I have played around with various of the events and settings but cant seem to get it to work right.

推荐答案

换句话说,您希望您的列表视图表现得像 Windows 开始屏幕一样?这个对我来说很残酷 - 鼠标部分很容易,但触摸部分没有那么多.事实证明,解决方案非常简单.您只需要为您的列表视图启用正确的选项.这是我的 xaml:

In other words, you want your listview to behave like the Windows Start screen? This one was brutal for me to figure out - the mouse part was easy, but the touch part not so much. The solution turns out to be pretty easy. You just have to enable the right options for your listview. Here's the xaml for mine:

<ListView
        x:Name="itemListView"
        SelectionMode="Extended"
        IsSwipeEnabled="True"
        IsItemClickEnabled="True"
        ItemClick="ItemView_ItemClick"
        />

抱歉,我还没想好如何让代码在 StackOverflow 中突出显示.

Sorry, I haven't figured how to get code to highlight in StackOverflow yet.

这篇关于ListView 项目选择 Windows 应用商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆