RadControls for WinForms

The following tutorial demonstrates creating a RadMenu with standard menu items with shortcuts, ComboBox menu elements and also shows how to apply a theme to RadMenu.

  1. Drag a RadMenu control from the toolbox to a form.
  2. Click in the area labeled Type Here and type "File".
  3. Press Enter.

    menus-menu-getting-started 001

  4. Click in the area labeled Type Here and type "Help".
  5. Press Enter.
  6. Drag Office2010Black theme component from your ToolBox to your form.
  7. Select the RadMenu control.
  8. Set the ThemeName property to Office2010Black.
  9. Select the "File" menu item.
  10. In the Properties window, click in the Items property.
  11. Click the ellipsis button.
  12. In the RadElement Collection Editor, click the drop-down arrow on the Add button. Select the RadMenuItem.
  13. Set the Text property of the new RadMenuItem  to "New".

    menus-menu-getting-started 002

  14. Add two more RadMenuItems. Set their Text properties to "Open" and "Save".
  15. Click OK.
  16. Select the "Help" menu item.
  17. In the Properties window, click in the Items property.
  18. Click the ellipsis button.
  19. In the RadElement Collection Editor, click the drop-down arrow on the Add button. Select the RadMenuComboItem.
  20. Clear the Text property of the new RadMenuComboItem.
  21. Expand the ComboBoxElement property of the RadMenuComboItem.
  22. Click in the Items property of the ComboBoxElement.
  23. Click the ellipsis button.
  24. In the RadItem Collection Editor, click the Add button.
  25. Set the Text property of the new RadComboBoxItem to "Forums".
  26. Add two more RadComboBoxItems. Set their Text properties to "Support" and "Knowledge Base".

    menus-menu-getting-started 003

  27. Click OK to close the first RadItem Collection Editor.
  28. Click OK to close the second RadItem Collection Editor.
  29. In order to assign a shortcut to a RadMenuItem, go to the Code View of the form and set the Ctrl+N shortcut to the 'New' menu item:
    Copy[C#]
    radMenuItem1.Shortcuts.Add(new RadShortcut(Keys.Control, Keys.N));
    Copy[VB.NET]
    RadMenuItem1.Shortcuts.Add(New RadShortcut(Keys.Control, Keys.N))
  30. Go to the Design View of the form and select the 'New' menu item.
  31. In the Properties window, click the events toolbar button.
  32. Double-click the Click event.
  33. Replace the automatically-generated event handler with this code:
    Copy[C#]
    private void radMenuItem1_Click(object sender, EventArgs e)
    {
        MessageBox.Show("New File");
    }
    Copy[VB.NET]
    Private Sub RadMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadMenuItem1.Click
        MessageBox.Show("New File")
    End Sub
  34. Return to the Design View of the form.
  35. Press F5 to run the project. Notice the menu styling, the use of Ctrl+N to trigger the message box, and the combo box in the Help menu.

    menus-menu-getting-started 004