Microsoft Developer Network > 포럼 홈 > Windows Presentation Foundation (WPF) > Multiselect ComboBox Implementation Ideas
질문하기질문하기
 

답변됨Multiselect ComboBox Implementation Ideas

  • 2006년 9월 8일 금요일 오전 3:49Kevin CheukMSFT사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    I need to create a ComboBox which allows for multiselection (the selections will be display in a comma delimited string of the TextBlock portion of the control).  Ideally, the dropdown of the ComboBox will be filled with items with a CheckBox, with the item being checked if it's been selected.  What would be the best way to approach such a control?  Should I modify the templates of either the ListBox control or the ComboBox control or create a new user control (maybe based off one these controls)?

    Thanks,

    Kevin

답변

  • 2006년 9월 26일 화요일 오후 3:45d00d 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    OK this may sound a little off but here it goes... Have a combobox containing a listbox which has checkboxes as its items... Will this help? I mean the combobox wont close when you are selecting items from the list; I haven't tried this though.

모든 응답

  • 2006년 9월 8일 금요일 오전 7:47d00d 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     제안된 답변
    An ideal solution would be to have the combo box contain CheckBoxes as its contents, this way you can allow multiple selections from the same ComboBox.
    • 답변으로 제안됨RSud 2008년 10월 16일 목요일 오후 11:35
    •  
  • 2006년 9월 9일 토요일 오후 10:29Kevin CheukMSFT사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    Thanks for the reply d00d.  I created a ComboBox control and changed its item template to datatemplate with a checkbox control in it.  The only problem with the control is once you select an item from the dropdownlist of the ComboBox, it disappears.  How can keep this from occuring?  I want the dropdownlist to stay open for multiselection and for the dropdownlist to only close when the control loses focus (sort of like the MenuItem Control when you enable its StaysOpenOnClick property). 

    I've tried enabling the StaysOpenOnEdit property on the ComboBox and handling the PreviewMouseDown on  the ComboBox and ComboBoxItem, but to no success for either.  Anymore suggestions would appreciated. 

  • 2006년 9월 26일 화요일 오후 3:45d00d 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    OK this may sound a little off but here it goes... Have a combobox containing a listbox which has checkboxes as its items... Will this help? I mean the combobox wont close when you are selecting items from the list; I haven't tried this though.
  • 2008년 10월 17일 금요일 오후 7:39zepher684 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     제안된 답변
    jiggs said:

    Thanks for the reply d00d.  I created a ComboBox control and changed its item template to datatemplate with a checkbox control in it.  The only problem with the control is once you select an item from the dropdownlist of the ComboBox, it disappears.  How can keep this from occuring?  I want the dropdownlist to stay open for multiselection and for the dropdownlist to only close when the control loses focus (sort of like the MenuItem Control when you enable its StaysOpenOnClick property). 

    I've tried enabling the StaysOpenOnEdit property on the ComboBox and handling the PreviewMouseDown on  the ComboBox and ComboBoxItem, but to no success for either.  Anymore suggestions would appreciated. 



     Hey,
    Isn't it that if we click on the checkbox instead of the entire row the combobox dosen't collapse for each selection. This way byu clicking on the chekcbox we can do multiple select.
    Zepher684
    • 답변으로 제안됨zepher684 2008년 10월 17일 금요일 오후 7:39
    •