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. 

Adding Bunifu Dropdown at Design-time

Simply locate Bunifu Date Picker control in your toolbox and drag it to your form.

Adding Bunifu Dropdown at Runtime

To add Bunifu Date Picker at run time we will use form load event.

C# code

private void Form1_Load(object sender, EventArgs e)

{

    var dropdown = new Bunifu.UI.WinForms.BunifuDropdown();

    this.Controls.Add(dropdown);

}

Ensure you’ve attached the event to the Form Load’s event handler in order for the code to run.

VB.NET code

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 
    Dim dropdown As New Bunifu.UI.WinForms.BunifuDropdown
    Controls.Add(dropdown)
 
End Sub

How to add items to a dropdown or combo box

Simply use the Add() method as shown in the code below.

C# code

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);

}

VB.NET code

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim dropdown As New Bunifu.Framework.UI.BunifuDropdown

    dropdown.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.

Custom properties

  • 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

C# code

dropdown.Color = Color.DarkSlateBlue;

dropdown.ForeColor = Color.MediumPurple;

dropdown.IndicatorColor = Color.DarkSlateBlue;

dropdown.ItemBackColor = Color.DimGray;

dropdown.ItemBorderColor = Color.White;

VB.NET code

dropdown.Color = Color.DarkSlateBlue

dropdown.ForeColor = Color.MediumPurple

dropdown.IndicatorColor = Color.DarkSlateBlue

dropdown.ItemBackColor = Color.DimGray

dropdown.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

C# code

dropdown.SelectedIndex = 2; 

VB.NET code

dropdown.SelectedIndex = 2
  • TextAlign - 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

C# code

dropdown.TextAlign = Bunifu.UI.WinForms.BunifuDropdown.TextAlign.Center;

VB.NET code

dropdown.TextAlign = Bunifu.UI.WinForms.BunifuDropdown.TextAlign.Center;
  • FillDropDown -  This is a boolean property and allows you to set the fill type of the drop down to be either true or false
  • FillIndicator - This property allows you to set the fill type of the indicator to be either true or false

C# code

dropdown.FillDropDown = true;
dropdown.FillIndicator = true;

VB.NET code

dropdown.FillDropDown = true
dropdown.FillIndicator = true

The result should be something like this:

  • BorderRadius - This property allows you to set the border radius of the drop down edges
  • BorderThickness - This property allows you to set the thickness of the drop down border
  • ItemHeight - This property allows you to set the height of the drop down

Custom events

  • SelectedIndexChanged - This event occurs when a user selects an item in the drop down
  • TextChanged - 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.

Did this answer your question?