$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Buttons Control for WinForms UI Tutorial
Drop Down buttons design for C# Window Forms applications with the UI button component
Home > WinForms UI Controls > User Manual > Dropdown Button in C#

Drop Down Button - C# WinForms UI Design

The WinForms UI Button Component provides the drop down buttons, which are menu like interface model within a button. Each item of Drop Down Button can be set to perform an action with a single click. Furthermore, the items are able to contain other sub items.
To use the Drop Down Button control in the WinForms UI Controls Stuite, just drag and drop a Drop Down Button control to the form designer from the Toolbox. It can be used in the way of a standard button. Here are some properties available for developers to customize the controls. Text property can be used to control the displayed text. Just a single click, the Drop Down Button displays the drop-down items, which is different from the standard button. Therefore, it is not suitable to handle the click event of the button, but works directly with the click event with each item.
The Drop Down Button and Split Button have similar appearance. But there is an important programmatic distinction. On Split Button control, the property of Default Item indicates the item whose Click event will be triggered. If you want a button that does something when clicked as well as when a selection is made from the menu, the Split Button is the preferable control.

Related Button UI for C# Windows Forms Applications

How to Add Items with Drop Down Button Control

There is an item collection of the Drop Down Button, which defines the menu items displaying while clicking the Drop Down Button. To add items to your new button, drag and drop a Drop Down Button control from the Toolbox to the Forms that you are designing.

How to Add Items to Button at Design Time

  1. To add menu items at Design Time, click on the Items property to launch the Element Collection Editor.
  2. Click the arrow next to the Add button to add items to the menu. A variety of items are available for the collection.
  3. After adding a Menu Item to the collection, it will appear in the list on the left side of the dialog.
  4. Click the Menu Item to edit its properties in the corresponding property grid on the right of the dialog.
  5. In the property of grid, you will find many of the standard control properties available.

Properties Available

  • Text property is able to specify the text appearing on the item
  • Tool Tip Text will appear when we move the mouse to hovers over an item.
  • Child Collection of Items, each Menu Item contains a child collection of Items, which allows developers to create menu hierarchies in the Split Button.
  • Image, associate an image to an item or associate a standard Image List component to the Split Button. The Image Index or Image Key property is for the item.
  • Popup Direction determines the direction in which the child items of a Menu Item will be displayed and can be left, right, up or down.
  • Two Columns and Right Column Items, display child items in two columns.
  • Check on Click toggles a check mark next to a Menu Item.

How to Add Items to Button at at Run Time in Code

The below C# code demonstrates how to add a Menu Item of WinForms UI Control to the Dorp Down button

void Form1_Load(object sender, EventArgs e)
{
MenuItem myMenuItem = new MenuItem();
myMenuItem.Text = "My New Item";
dropDownButton1.Items.Add(myMenuItem);
myMenuItem.Click += new EventHandler(myMenuItem_Click);
}

void myMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show((sender as Telerik.WinControls.UI.MenuItem).Text +
" was clicked.");
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls