“全选"我的VS2010中没有该方法 [英] "Select all" method is not available in my VS2010

查看:142
本文介绍了“全选"我的VS2010中没有该方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过单击全选"按钮来选择列表框中的所有项目,
我从MSDN网站上获得了一些信息,
http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.selectall.aspx [ ^ ]
但是,当我尝试使用全选"方法时,它表明找不到这种方法.

我已经将引用PresentationFramework.dll导入到我的解决方案中.

Im trying to select all items in a listbox by clicking a "Select all" button,
and i got some info from MSDN website,
http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.selectall.aspx[^]
However when i try to use "Select All" method,it shows that such method could not be found.

I had already import the reference PresentationFramework.dll to my solution.

推荐答案

等待!你把一切都弄糊涂了!这与VisualStudio无关.并且您可以使用WPF或WindowsForms控件. PresentationFramework.dll是WPF,该链接用于WindowsForms控件.
要允许用户选择wpf列表框中的所有元素,请点击此处: http://stackoverflow.com/questions /1030276/wpf-listbox-and-select-all [ ^ ]
如果要以编程方式选择所有元素,则可以使用 SelectedItems [^ ]属性,并添加绑定源中的所有元素(请不要忘记设置多个选择模式 [^ ])
Wait! You have confused everything! This has nothing to do with VisualStudio. And either you use WPF or WindowsForms control. PresentationFramework.dll is WPF, the link is for the WindowsForms control.
To allow user to select all elements in wpf listbox look here: http://stackoverflow.com/questions/1030276/wpf-listbox-and-select-all[^]
If you want to select programatically all elements, you can use the SelectedItems[^] property, and add all elements from the bound source (don''t forget to set multiple selection mode[^])


这篇关于“全选"我的VS2010中没有该方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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