Is there any native WPF Multiselect combobox available?

拥有回忆 提交于 2019-11-29 09:33:55

There is no native multiselect combobox in WPF. Please check my blog for a simple hack using expression blend to achieve a multi selection on combobox. http://jobijoy.blogspot.com/2009/02/simple-multiselect-combobox-using.html The idea is to utilize the Multi-Selection feature of ListBox in to ComboBox by editing the control template.

But for accessing the selected items you might need to use the bellow line in the code.

((ListBox)cmbBox.Template.FindName("lstBox",cmbBox)).SelectedItems

Where cmbBox is your combobox and lstBox is the ListBox inside the controltemaplate.

Adrian

I'm not sure how a ComboBox would display data in this fashion, as it is designed as a single-selection Control.

Maybe you are looking for something like a ListBox or ListView with a SelectionMode of Multiple or Extended?

<ListBox SelectionMode="Multiple" />

<ListBox SelectionMode="Extended" />

I used an expander and filled the expander's header with the selection and the content with a list box. The list box is binded to a collection. Whenever user make a selection, I update the header to show what user has selected.

I found this useful information from Codeproject - ComboBoxMultiSelect

I haven't tried it myself as of yet, but would let know about my experience.

Although I am yet to get this to work, this looks like what I need and similar to what you are looking for:Just Guy's Blog

Another CodeProject with detailed explanations how to create a ComboBox with multiple selectable Checkboxes: Multi Select ComboBox in WPF

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!