We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Keeping a Combo Popup from closing when a checkbox is clicked.

I derived a ComboBox of mine from ComboBoxExt and I am using a CheckedListBox a its ListControl. I decided to derive because I want the TextBox to display all the currently checked items separated by comma. Now I''d like to be able to check more than one item without having to press the dropdown button each time to show the listbox. I looked at the source code of the control, but could not find a way to trap the click on the checkboxes so that I could stop the popup window from closing up. It seems that the relevant methods are private and I can''t get at them. Can you help, please?

3 Replies

AD Administrator Syncfusion Team September 8, 2004 01:11 AM UTC

Hi Raul, You could handle the ComboBoxExt''s DropDownCloseOnClick event set its Cancel property to true for this purpose. private void comboBoxExt1_DropDownCloseOnClick(object sender, Syncfusion.Windows.Forms.Tools.MouseClickCancelEventArgs args) { args.Cancel = true; } I have created a test sample as per your specifications above (i.e., allow multiple selections without closing the dropdown and all the selections are displayed in the Text with each item being separated by a comma), and have attached it here. Please refer to it and let me know if you need further assistance. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

RR Raul Rosenthal September 8, 2004 11:35 AM UTC

Hmm, I tried but it does not work very well. In your sample, all is fine, but you have to click twice on the checkboxes (the first click just selects the item) I prefer the derived class approach, because I need a bunch of controls and I''d rather prefer not to duplicate the code in the DropDownCloseOnClick event handler. I overrode GetPopupText and OnDropDownCloseOnClick. GetPopupText build a string with the checked items separated by comma. OnDropDownCloseOnClick is as follows: protected override void OnDropDownCloseOnClick(Syncfusion.Windows.Forms.Tools.MouseClickCancelEventArgs args) { args.Cancel = true; base.OnDropDownCloseOnClick( args ); Text = GetPopupText(); } I get the same behaviour as your sample regarding the need to click twice on the checkboxes. Moreover, when the code in OnDropDownCloseOnClick is executed the checkbox if not checked yet, so the Text field is not updated as expected.

AD Administrator Syncfusion Team September 8, 2004 08:13 PM UTC

Hi Raul, Thanks for sharing your solution with us. Please let me know if you need any other information. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Live Chat Icon For mobile
Up arrow icon