C# Drop Down and C# List Component Overview
Both the DropDownList Control and List Control are designed for developers to alter the standard Windows Forms combo box control and enrich the UI design for their Windows Forms applications. The DropDown and List control can be bound to data sources and visualize the control and manage the data. With the Drop Down and List Control, it is able to provide their own data layer to control the scrolling logic, the items layout, and the low level data binding logic. The DropDownList Control and List Control contain plenty of items and support auto complete, sorting, and filtering etc.
The C# tutorial below shows the process of adding items and images to the Drop Down List Control and retrieving the chosen text and images.
- Drag and drop a Drop Down List control and a Status Strip control to the Windows Form you are building.
- Add several images to the .NET Windows Forms project as resources.
- Open the downward arrow from the Status Strip, and add a Label Element and a Button Element. Change the Display Style of the Button Element to the value as Image.
- Choose Drop Down List Control and select the Items property in the Property Window in your Visual Studio IDE.
- Open the Item Collection Editor by clicking the ellipsis button.
- Create list items by clicking the Add button. Set the text to the items and the resource images to the Image property of the items. And then close the Item Collection Editor.
- Choose the Events button from the Properties Window and locate and double-click the event, DropDownListChosenIndexChanged, to create an event handler.
- Copy and paste the C# code below to the above event handler to retrieve the chosen item, and assign the text and image for the chosen item to the status bar label and image elements.
void dropDownList_ChosenIndexChanged(object sender, Kettic.UI.WinForms.Data.PositionChangedEventArgs e)
if (this.dropDownList.ChosenIndex > -1)
this.labelElement1.Text = this.dropDownList.ChosenItem.Text;
this.imageButtonElement1.Image = this.dropDownList.ChosenItem.Image;