如何在WPF中使用搜索功能组合框实现多选 [英] How to implement Multiple selection with search feature combo-box in WPF

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

问题描述

如何在Window presentation foundation(WPF)中使用搜索功能组合框实现多项选择,如下面的链接。

< a href =" http://www.igniteui.com/ combo / selection-and-checkboxes">选择和复选框示例 - 带组合框控件的选择和复选框 - Ignite UI™< / a> [< a href =" http://www.igniteui.com/combo /选择和复选框"目标= QUOT; _blank" title =" New Window"> ^< / a>]

任何建议都将受到赞赏..谢谢..

How to implement Multiple selection with search feature combo-box in Window presentation foundation(WPF) like below link.
<a href="http://www.igniteui.com/combo/selection-and-checkboxes">Selection and Checkboxes Sample - Selection and Checkboxes with Combo Box Control - Ignite UI™</a>[<a href="http://www.igniteui.com/combo/selection-and-checkboxes" target="_blank" title="New Window">^</a>]
Any suggestion will be appreciated.. Thanks..

推荐答案

我强烈建议使用复选框元素创建一个组合框,而不是多选组合框。这样,检查状态而不是选择提供更好的视觉反馈,减少意外错误等。例如,很难实现未选择状态,然后看到突出显示和选择之间的区别,等等。多选列表框或组合框样式与常规UI样式不完全一致。



在WPF中从头开始实现很容易,但请参阅,例如,< a href =http://www.c-sharpcorner.com/UploadFile/1a81c5/multi-select-combobox-in-wpf> C#Corner:在WPF中选择多个ComboBox 。



如果您仍然想要多次选择,可以使用 ListBox 而不是 ComboBox 您可以在自己的组合控件( UserControl 或自定义控件)中与 TextBox 结合使用。如果你想要这个替代方案,可以使用 ListBox.SelectionMode

ListBox.SelectionMode属性(System.Windows.Controls) [ ^ ],

SelectionMode枚举( System.Windows.Controls) [ ^ ]。



但我仍强烈建议您更喜欢列表元素中的复选框。< br $> b $ b

新年快乐!



-SA
Instead of multi-selection combo box, I would strongly recommend to create a combo box with check box elements. This way, check states instead of selection provides better visual feedback, reduces accidental mistakes, and so on. It would be hard, for example, to implement "nothing selected" state and then see the difference between highlighting and selection, and so on. Multi-selection list box or combo box style is not quite consistent with customary UI styles.

It's easy to implement from scratch in WPF, but see, for example, C# Corner: Multi Select ComboBox in WPF.

If you still want multiple selection as it is, you could use ListBox instead of ComboBox which you can combined with TextBox in your own combined control (UserControl or custom control). If you wanted this alternative, you could use ListBox.SelectionMode:
ListBox.SelectionMode Property (System.Windows.Controls)[^],
SelectionMode Enumeration (System.Windows.Controls)[^].

But I still would strongly recommend to prefer check boxes in the list elements.

Happy New Year!

—SA


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

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