如何在uwp中的gridview中进行多选? [英] How to multi-select in gridview in uwp?

查看:134
本文介绍了如何在uwp中的gridview中进行多选?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Gridview控件中,如何使用鼠标点击拖动选择多选图形视图项,就像我们使用鼠标在Windows资源管理器中选择文件/文件夹一样?



喜欢这个选择



如果没有可用的鼠标点击拖动多选,请提供我自己如何实现的任何代码/想法。



我尝试过:



微软的文档,我只能看到单/多/扩展选择,用户必须单击每个Gridviewitem的复选框才能进行多选。即我应勾选每个GridViewitem中的复选框,如果选择超过20或30个项目,则需要更多时间。这似乎是一种无效的方式。

解决方案

之前没有使用过UWP,但是看一下文档,似乎不支持拖放功能通过常规GridView。在这种情况下,您可能需要通过扩展GridView控件来构建自定义控件,就像在此示例中一样:使用拖放扩展GridView以进行分组和变量大小的项目 [ ^ ]



回头看< a href =https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/listview-and-gridview>文档,要做多项选择,你有使用SHIFT或CTRL键。由于UWP应用可以针对包括触摸屏在内的不同设备,因此他们就是这样设计的。



另外,我不确定这是否适合你: https://stackoverflow.com/questions/35890625/win-rt-xaml-gridview-drag-select-multiple-items

In Gridview control, how to multi select the gridview items using mouse click-drag selection, like we select files/folders in windows explorer using mouse?

Like this Selection

If there is no mouse click-drag multi-selection available, please provide any code/idea of how to implement that myself.

What I have tried:

In Microsoft's docs, I could see only Single/Multiple/Extended selection, in which user has to click each Gridviewitem's checkbox to multi-select. i.e. I should tick the checkboxes in each GridViewitem, which takes more time if select more than 20 or 30 items. This seems an in-efficient way.

解决方案

Haven't worked with UWP before, but looking at the docs, it seems like the drag and drop functionality is not supported by the regular GridView. In this case, you may need to build a custom control by extending the GridView control just like in this example: Extending GridView with Drag and Drop for Grouping and Variable Sized Items[^]

Looking back at the documentation, To do multiple selection, you have to use SHIFT or CTRL keys. Since a UWP app can target different devices including touch screens, they've designed it that way.

Also, I'm not sure if this will work for you: https://stackoverflow.com/questions/35890625/win-rt-xaml-gridview-drag-select-multiple-items


这篇关于如何在uwp中的gridview中进行多选?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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