Winforms — multi select dropdown list

后端 未结 4 2013
Happy的楠姐
Happy的楠姐 2020-12-24 02:47

I\'m shopping around for a dropdown list control that allows me to select multiple items. Something akin to the CheckedListbox, but in dropdown list form (I don\'t want it

4条回答
  •  不知归路
    2020-12-24 03:16

    There is yet another fix:

    The above solution is correct to fix the first issue, where it required two clicks to enter the list of checkboxes, however, this introduces a new issue when you click the control to exit it, it retains focus and you must double click to go to another control. I was able to fix this with the following code:

    In CheckBoxComboBox.cs add the following override:

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);
            this.Parent.Focus();
        }
    

    With the answer from Rob P. and this answer, it will not hold focus on either click event.

提交回复
热议问题