Is there any native WPF Multiselect combobox avail

2019-01-26 06:02发布

Even a 3rd party one will do.

Thanks

6条回答
再贱就再见
2楼-- · 2019-01-26 06:44

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-26 06:50

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

查看更多
SAY GOODBYE
4楼-- · 2019-01-26 06:52

I found this useful information from Codeproject - ComboBoxMultiSelect

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

查看更多
对你真心纯属浪费
5楼-- · 2019-01-26 06:54

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" />
查看更多
唯我独甜
6楼-- · 2019-01-26 06:54

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.

查看更多
何必那么认真
7楼-- · 2019-01-26 07:00

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

查看更多
登录 后发表回答