Are there any Dropdown controls with checkboxes in them? - c#

I've seen some for web using javascript, but I am looking for a Windows Form control that is a ComboBox that when opened displays a list of checkboxes and labels, allowing to select one or more, with a "Select All" option.
Would like a non-commercial solution.

I hate to suggest a commercial solution, however, I am using the DevExpress Winforms suite and it has exactly what you are looking for. Plus it really let's you really customize it (as you see in the example below).

why can't you build your own checked comboBox by integrating a label, button and a checked listbox?

Related

Combo box in WPF application with select/deselect all

Currently we have a WPF application being built in C# using Visual Studio 2010. There is a combo box that has check-boxes in it, but we would like there to be a select/deselect all option. This would be essentially the same as what you see in the auto-filter drop-downs in MS Excel 2007/2010, where you can select all checkboxes or deselect all checkboxes. The combo box is populated from a field in a SQL Compact Database, whose records depend on the value selected in another combo box (so the other combo box acts as a filter for which values you would see in this drop-down).
This feature has been on our plate for months, but the technical team keeps pushing back for the next release because they say it's too difficult to implement. I'm the business analyst on the application, not the actual programmer, but I figured I would come here to elicit some help.
Is this really something that is difficult to achieve (as in, it would take at least a week to implement)? What would be the way to go about achieving this?
Here's a solution from someone on MSDN. I created a new WPF project to try it out... it works. You can check individual checkboxes. If you check or uncheck the Select All option, all other checkboxes are checked or unchecked accordingly. Took about 5 minutes to create and test.
Of course, it may be that your team has overridden the functionality of the control in some way or they'll hit some other limitation and not be able to implement this, but the combobox should support it.

Visual objects that change size in c# displayed in a linear list

Please forgive any silly words I may say. I am coming from a Actionscript3 background.
I am using "Visual C# 2010 Express".
I have a simple Form, in a WindowsForm Project, which currently holds just a Listbox. (Which I presume I will have to change to something else).
And I made myself a different display object (User Control) that is currently a Checkbox a title. (More will be added once I get over the hurdle below)
But I can't even get as far as Displaying the UserControl as a list.
I can't seem to find anywhere on the listbox to say "User this displayobject as the visual for listbox". I see tutorials saying "ItemsPanelTemplate" but I get error saying there is no such property for a Listbox.
I even tried making the Form in Design view and it is not in the list down the side of the GUI when I dragged as Listbox on screen.
Now I know how I would do this in pure Actionscript, but I dont know how to do this in Pure C#. Tutorials are not helping, as all the Microsoft site seems to try to give me is XAML (XML). and I am looking for C# code. So I have thrown in the towel and pleading for outside help.
Thank you for any help you can give.
It sounds like you want a list of items, each with a CheckBox and some descriptive text. Try using the CheckedListBox control. MSDN link.
This question also answers the question of how to do custom image drawing for each item in a ListBox. It may be helpful.
Edit after clarification:
Try embedding the UserControl in a ListView, rather than a ListBox.
References on embedding controls in ListViews:
C# listview - embedding controls
Adding button into a Listview in WinForms
You could also use a list of Panels, with each Panel hosting a UserControl.
C# List of Panels
But the real answer, as seen in the question's comments, is that Winforms doesn't have a convenient way to do this. This is a task much better suited to WPF.
You may check out freeware component Better ListView Express from ComponentOwl. It supports simple Details view without columns, two and three-state checkboxes, images and more...
They also offers full version with even more nice features like hierarchical and multi-line items.

.NET Choose Items Dialog

Is there a standard .NET control for what I call "a two pane picker", or do I have to code it by hand?
Two pane picker:
The left pane has a list of items.
The user can pick items from the left pane to put them in the right pane using buttons between the two panes.
Picked items in the right pane can be reordered with buttons.
An example of the "two pane picker" can be found by right clicking the Quick Access toolbar in Word 2007 and clicking "Customize Quick Access Toolbar..."
Note: If applicable, VB.NET answers preferred, but C# answers are acceptable too.
There's no standard control for that. Sounds like an excellent case for a custom user/composite control.
There are no .NET Framework controls which create the functionality you describe, however it is fairly easy to implement. Here's some examples I was able to find (not tested):
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1253&lngWId=10
http://www.dotnetspider.com/resources/18324-Content-Transfer-between-Two-listboxes.aspx
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/2082caa0-5ece-4ad8-8077-8c7170fa6f9f
There is no standard picker. You have to build it yourself or find a third party control.
I don't know of anything like that, but its trivial to implement with two ListBoxes and some buttons. When 'Add' is clicked, do .Remove with the item at the selectedIndex from the left and .Add it to the ListBox on the right.

ASP Telerik Rad ColorPicker

I have three radio buttons High, Medium, and Low. If I check High it should show color which has been recently set in the color picker. Similarly for other two buttons. If i check a button only their respective color should be set in colorpicker control.
Two things:
I'd encourage you to use the Telerik Forums for Telerik specific questions. You'll get faster and more focused help.
In this case, it's not entirely clear what you're trying to do. Some code showing what you've tried would be useful. In general, it's best to share what you've tried and ask for help if you get stuck.
To give you something to try, make sure you explore the Telerik Online Demos for RadColorPicker. There are demos that show you how to work with the Server and Client-side APIs, giving you all the tools you need to implement your scenario (such as the client-side method get_selectedColor):
http://demos.telerik.com/aspnet-ajax/colorpicker/examples/clientsideapi/defaultcs.aspx

How to build a Windows Forms email-aware text box?

I'm building a C# client app that allows a user to communicate with one or more existing users in a system via an email-like metaphor. I'd like to present the user with a text entry box that auto-completes on known email addresses, and allows multiple delimiter-separated addresses to be entered. Ideally, I'd also like the email addresses to turn into structured controls once they've been entered and recognized. Basically, I'm modeling the UI interaction for adding users after Facebook's model.
Are there any Windows Forms controls out there with the ability to do something like this? Is there any well-established terminology for a hybrid textbox / control list box (no, not a ComboBox) or something that I should be searching for?
Thanks,
-Patrick
I have had good luck in the past creating composite user-controls to provide specific functionality using native .NET Winforms controls. It works pretty good as long as there aren't too many of them, in which case things start to slow down.
In you case, and this is just off the top of my head, but, perhaps you could take a FlowLayoutPanel, a Button, and a Textbox which supports auto-complete and put these together to create a control that would provide the functionality you are looking for.
If there are no addresses selected in the control (e.g. in a List<string>), then the container (FlowLayoutPanel) would only display the TextBox. Once the user selected an entry, the control would automatically create a Button with the appropriate caption and insert it to the left in the FlowLayoutPanel. If the user removes an address he/she has already selected, simply remove its representation (the button) from the FlowLayoutPanel, and the TextBox can resize accordingly. There may be issues with getting the TextBox to fill up the remaining space (I can't remember how to do that), but you get the idea. The container does not have to be FlowLayoutPanel - you could use a Panel with Docked controls, or even a TableLayoutPanel for this.
A design as I described would allow the user to delete the address by clicking on the button. However, without some other visual cues, that isn't very intuitive or user-friendly, so I would consider making the "Button" be another composite control which contains a "prettied-up" label along with an tiny delete Button (X) to the right. For this you could use a Panel control and dock the X button to the right, and fill the Label on the left. You would provide public properties here as needed to control the text and provide an event handler or callback for the delete functionality.
Once the visual stuff is working, all that is left is to provide the appropriate Properties and Methods on the main control to allow it to interact as needed with outside code.
As a simple, "poor man's", implementation you could take a look at the AutoComplete* properties of the TextBox control. You could dynamically populate the AutoCompleteSource with your known addresses and when an entry matches, add to a separate, list-style control of your choice.
See this SO article for some interesting code snippets related to your question, and my suggested workaround.
Beyond the built-in AUtoComplete properties you're probably looking at having to purchase a 3rd party control from a tools vendor.
I've not seen anything like that before in WinForms. In WPF it would be another matter - if you can use that, maybe consider hosting a WPF control within your WinForms application instead?
I think you're trying to do something similar to this codeproject article: AutoComplete TextBox
And since you mention WPF in a comment, you also have this article: WPF AutoComplete Folder TextBox (should be easy enough to cut out the folder bit of the article I'd thought).
Well, there isn't such a control. If I were you, I'd create 2 textboxes to do the job. See, a normal textbox can easily be configured for autocomplete from a list, even dynamically; however, it accepts only one entry at a time.
So, I suggest you dedicate one textbox for autocomplete, and one for the addresses. So, whenever there is a qualified email address in the first textbox, and you click enter, the address gets added to the address textbox, and automatically add delimitation.
Then you need to handle the addresses in the address textbox as objects instead of characters. Code it in a way that when a user tries to delete a character in an address, the whole address is deleted.
This is the workaround I can think of. I'll help with the code if you give it a try.

Categories