列表视图多选 [英] Listview Multiple Selection

查看:131
本文介绍了列表视图多选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来强制ListView控件把所有的点击好像他们是通过控制键做了什么?

Is there any way to force a listview control to treat all clicks as though they were done through the Control key?

我需要复制使用的功能控制键(选择项目集和取消设置其选择状态),以允许用户容易地选择在同一时间的多个项目

I need to replicate the functionality of using the control key (selecting an item sets and unsets its selection status) in order to allow the user to easily select multiple items at the same time.

感谢您预先

推荐答案

这不是标准行为的ListView控件,即使在多选设置为true。

It's not the standard behaviour of the ListView control, even when MultiSelect is set to true.

如果你想创建自己的自定义控制,你需要做到以下几点:

If you wanted to create your own custom control you would need to do the following:


  1. 从派生的ListView

  2. 控件添加一个处理程序的选定事件。

  3. 在OnSelected,维护自己选定的产品清单。

  4. 如果新选择的项目不在列表,添加它。如果是,将其删除。

  5. 在代码中,在列表中选择所有项目。

  1. Derive a control from ListView
  2. add a handler to the "Selected" event.
  3. In the "OnSelected", maintain your own list of selected items.
  4. If the newly selected item is not in your list, add it. If it is, remove it.
  5. In code, select all of the items in your list.

应该足够简单实现,感觉像多选不使用控制键!

Should be simple enough to implement and feel like multi-select without using the control key!

这篇关于列表视图多选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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