简体   繁体   English

WPF应用程序中的组合框具有全选/取消全选

[英]Combo box in WPF application with select/deselect all

Currently we have a WPF application being built in C# using Visual Studio 2010. There is a combo box that has check-boxes in it, but we would like there to be a select/deselect all option. 当前,我们有一个使用Visual Studio 2010 C#构建的WPF应用程序。其中有一个带有复选框的组合框,但是我们希望有一个select / deselect all选项。 This would be essentially the same as what you see in the auto-filter drop-downs in MS Excel 2007/2010, where you can select all checkboxes or deselect all checkboxes. 这与您在MS Excel 2007/2010中的自动过滤器下拉列表中看到的内容基本相同,您可以在其中选择所有复选框或取消选择所有复选框。 The combo box is populated from a field in a SQL Compact Database, whose records depend on the value selected in another combo box (so the other combo box acts as a filter for which values you would see in this drop-down). 组合框是从SQL Compact数据库中的一个字段填充的,该字段的记录取决于在另一个组合框中选择的值(因此,另一个组合框将充当您在此下拉列表中看到的值的过滤器)。

This feature has been on our plate for months, but the technical team keeps pushing back for the next release because they say it's too difficult to implement. 此功能已经在我们的平台上使用了几个月,但是技术团队一直在努力推迟发布下一个版本,因为他们说实施起来太困难了。 I'm the business analyst on the application, not the actual programmer, but I figured I would come here to elicit some help. 我是应用程序的业务分析师,而不是实际的程序员,但我认为我会来这里寻求帮助。

Is this really something that is difficult to achieve (as in, it would take at least a week to implement)? 这真的很难实现吗(例如,至少需要一周的时间才能实现)? What would be the way to go about achieving this? 实现这一目标的方法是什么?

Here's a solution from someone on MSDN . 这是MSDN上某人的解决方案。 I created a new WPF project to try it out... it works. 我创建了一个新的WPF项目来进行尝试...它可以工作。 You can check individual checkboxes. 您可以选中各个复选框。 If you check or uncheck the Select All option, all other checkboxes are checked or unchecked accordingly. 如果您选中或取消选中“全选”选项,则会相应地选中或取消选中所有其他复选框。 Took about 5 minutes to create and test. 花了大约5分钟来创建和测试。

在此处输入图片说明

Of course, it may be that your team has overridden the functionality of the control in some way or they'll hit some other limitation and not be able to implement this, but the combobox should support it. 当然,可能是您的团队以某种方式超越了控件的功能,否则他们将遇到其他限制并且无法实现此限制,但是组合框应支持它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM