Easily add stylish looking drop downs in your user interface with Bunifu Drop Down. You add date picker at design time or at run time.
Simply locate BunifuDropDown
control in your toolbox and drag it to your form.
To add Bunifu Date Picker at run time we will use form load event.
private void Form1_Load(object sender, EventArgs e){var dropdown = new Bunifu.UI.WinForms.BunifuDropdown();this.Controls.Add(dropdown);}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadDim dropdown As New Bunifu.UI.WinForms.BunifuDropdownControls.Add(dropdown)End Sub
Ensure you’ve attached the event to the Form Load’s event handler in order for the code to run.
Simply use the Add() method as shown in the code below.
private void Form1_Load(object sender, EventArgs e){var dropdown = new Bunifu.Framework.UI.BunifuDropdown();dropdown.Items.Add("Item 1");dropdown.Items.Add("Item 2");dropdown.Items.Add("Item 3");this.Controls.Add(dropdown);}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadDim dropdown As New Bunifu.Framework.UI.BunifuDropdowndropdown.Items.Add("Item 1")dropdown.Items.Add("Item 2")dropdown.Items.Add("Item 3")Controls.Add(dropdown)End Sub
The added items should display in the drop down as shown below.
Color
- This property allows you to set the border color of the drop down control
ForeColor
- This property allows you to set the text color of the items in the drop down control
Indicator
- This property allows you to set the color of the indicator
ItemBackColor
- This property allows you to set the background color of the drop down list
ItemBorderColor
- This property allows you to set the border color of the drop down list
To customize drop down colors using code we will name our drop down dropdown
dropdown.Color = Color.DarkSlateBlue;dropdown.ForeColor = Color.MediumPurple;dropdown.IndicatorColor = Color.DarkSlateBlue;dropdown.ItemBackColor = Color.DimGray;dropdown.ItemBorderColor = Color.White;
dropdown.Color = Color.DarkSlateBluedropdown.ForeColor = Color.MediumPurpledropdown.IndicatorColor = Color.DarkSlateBluedropdown.ItemBackColor = Color.DimGraydropdown.ItemBorderColor = Color.White
Below is the output of the code above
SelectedIndex
- When selecting an item from a list, the Index value associated with the item is stored inside the SelectedIndex. When there is no item is selected, the SelectedIndex is equal to -1. You can select (highlight) an item in a list by passing a numeric value to the SelectedIndex property
dropdown.SelectedIndex = 2;
dropdown.SelectedIndex = 2
This property allows you to set the alignment of the text of your list items. You have the following options i.e. left, right or center
dropdown.TextAlign = Bunifu.UI.WinForms.BunifuDropdown.TextAlign.Center;
dropdown.TextAlign = Bunifu.UI.WinForms.BunifuDropdown.TextAlign.Center;
This is a boolean property and allows you to set the fill type of the drop down to be either true or false
This property allows you to set the fill type of the indicator to be either true or false
dropdown.FillDropDown = true;dropdown.FillIndicator = true;
dropdown.FillDropDown = truedropdown.FillIndicator = true
The result should be something like this:
This property allows you to set the border radius of the drop down edges
This property allows you to set the thickness of the drop down border
This property allows you to set the height of the drop down
This event occurs when a user selects an item in the drop down
This event occurs whenever a user types into the Text area of the drop down. The event is triggered whenever a character typed
That's it!
We hope you will enjoy using Bunifu Dropdown control and that it will help you create better user experience for your users.
Should you have feedback or suggestions please send us via chat on the bottom right corner of the screen.