如何在Wpf中的组合框中实现多项选择 [英] How Do I Acheive Multi Selection In A Combobox In Wpf

查看:281
本文介绍了如何在Wpf中的组合框中实现多项选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WPF新手,我正在寻找一个带有复选框的下拉列表来选择多个值。下拉列表的来源是列表(列表< string>)..

I am new to WPF , I am looking for a dropdown with checkbox to select multiple values. The source to the drop down would be from a list (list<string>)..

推荐答案

检查以下链接...

它有帮助

http://www.c-sharpcorner.com/UploadFile/1a81c5/multi-select- combobox-in-wpf / [ ^ ]





Happy Coding
Check below link...
it helps
http://www.c-sharpcorner.com/UploadFile/1a81c5/multi-select-combobox-in-wpf/[^]


Happy Coding


First of总而言之,最好避免多项选择,这种选择很容易被任何一只手轻易摧毁。更好的解决方案不是基于选择,而是基于检查。所以,你需要有一个类似组合框的复选框列表。



然后,WPF 内容模型的灵活性允许你有任何对象作为控件项,如 ComboBox ListBox 。在最简单的方法中,这些项可以是任何UI元素,并且像 Panel 这样的UI元素可以容纳任何上下文,包括复选框和标题的组合。更好的是,您可以使用模板来实现项目的任何特定自定义演示。



但是这样的解决方案已经存在。首先,请查看Extended WPF Toolkit: https://wpftoolkit.codeplex.com/wikipage?title=CheckComboBox



此CodeProject文章中提供的解决方案也很有用: WPF中的多选ComboBox



-SA
First of all, it's better to avoid multi-item selection which can be easily destroyed by any slip of a hand. Much better solution would be based not on selection, but on checking. So, you would need to have something like a check box list of the combo box.

Then, the flexibility of WPF content model allows you to have any any objects as the items of controls like ComboBox or ListBox. In the simplest approach, such items can be any UI elements, and a UI element like Panel can house any context, including a combination of a check box and a title. Better yet, you can use templating to implement any specific customize presentation of items.

But such solutions already exist. First of all, look at Extended WPF Toolkit: https://wpftoolkit.codeplex.com/wikipage?title=CheckComboBox.

The solution presented in this CodeProject article can also be useful: Multi Select ComboBox in WPF.

—SA

这篇关于如何在Wpf中的组合框中实现多项选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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