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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sample of dropdown Checked ListBox in grid

Thread ID:





14744 Jun 3,2004 02:43 PM UTC Jun 10,2004 03:30 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On June 3, 2004 02:43 PM UTC

Hi, I am using Databound grid. Do you have a sample with a dropdown checked listbox sample for this? thanks, - Reddy

Administrator [Syncfusion]
Replied On June 3, 2004 03:02 PM UTC

We ship a sample in the 2.0 code base,\Grid\Samples\In Depth\DropDownFormAndUserControlSample that shows how to put a control in a dropdown form or in a dropdown user control (either model or modelless). And the example control we use is a CheckedListBox. I think the code should work OK in (as long as you comment out any new properties being set in the designer code - you''ll see syntax error when you try to compile - if there are any). CS_7730.zip

Administrator [Syncfusion]
Replied On June 9, 2004 08:06 PM UTC

Clay, I am using the DropDownUserControl technique. Is there any way to get the focus into the drop down user control''s checked listbox by default when the combobox is dropped down? I tried adding ddUser.Focus() at the end of DropDownContainerShowingDropDown() method, right after ddUser.Visible = true. It is not working. thanks, - Reddy

Administrator [Syncfusion]
Replied On June 9, 2004 09:32 PM UTC

Even if you place a CheckedListBox directly on a Form, it takes two clicks to change a check. The first click highlights the item, and the second click checks/unchecks the item. If you want to select an item in the checkedlistbox when the user control gets focus, I think you will have to explicitly do it, and not just set the control focus. So, maybe make the checkedListBox1 public so you can access it out of the class, and then use code like: ddUser.Focus(); ddUser.checkedListBox1.SelectedIndex = 0; to select the first item.

Administrator [Syncfusion]
Replied On June 10, 2004 01:28 PM UTC

For testing I added a textbox before the checked listbox and set proper tabstops. It is not getting focus either. When the ''CheckOnClick'' property of the checked listbox is true, it will automatically check when you click on a checkbox. It does not require two clicks. Since the checked listbox does not support multiple columns, I am using a databound grid and making it look like checked listbox. Setting the checkedlistbox.SelectedIndex = 0 does not work. I added Enter/Leave handlers and printed a debug statement. As soon as I click the drop down button in the main form, I am getting "DDUser got focus" and "DDUser lost focus" immediately. So, I think grid is requesting focus (may be to current cell ??) back after DropDownContainerShowingDropDown() is called. Any ideas... thanks, - Reddy

Administrator [Syncfusion]
Replied On June 10, 2004 02:22 PM UTC

This seemed to work for me. Subscribe to the user control''s VisibleChanged event in the renderer''s constructor. Then in the handler, do a fake mouse click on the control in the user control you want to have focus.
//in renderer''s contructor
this.ddUser.VisibleChanged += new EventHandler(ddUser_VisibleChanged);

//the handler
private void ddUser_VisibleChanged(object sender, EventArgs e)
		Point p = new Point(2,2); //just some point in the checkedlistbox
		Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(this.ddUser.checkedListBox1, p);

Administrator [Syncfusion]
Replied On June 10, 2004 03:30 PM UTC

Clay, You da man!!! As usual, it works like a charm. - Reddy


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon