Edit this page

Getting Started

The following tutorial demonstrates creating a RadMenu with standard RadMenuItems with shortcuts and RadMenuComboItems.

1. Drag a RadMenu control from the toolbox and drop it onto the 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. Select the File menu item.

7. In the Properties window, click in the Items property.

8. Click the ellipsis button.

9. In the RadItem Collection Editor, click the drop-down arrow on the Add button. Select the RadMenuItem.

menus-menu-getting-started 005

10. Set the Text property of the new RadMenuItem to New.

menus-menu-getting-started 002

11. Add two more RadMenuItems. Set their Text properties to Open and Save.

12. Click OK.

13. Select the Help menu item.

14. In the Properties window, click in the Items property.

15. Click the ellipsis button.

16. In the RadItem Collection Editor, click the drop-down arrow on the Add button. Select the RadMenuComboItem.

17. Clear the Text property of the new RadMenuComboItem.

18. Expand the ComboBoxElement property of the RadMenuComboItem.

19. Click in the Items property of the ComboBoxElement.

20. Click the ellipsis button.

21. In the RadListDataItem Collection Editor, click the Add button.

22. Set the Text property of the new RadListDataItem to Forums.

23. Add two more RadListDataItems. Set their Text properties to Support and Knowledge Base.

menus-menu-getting-started 003

24. Click OK to close the RadListDataItem Collection Editor.

25. Click OK to close the RadItem Collection Editor.

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

Assigning shortcuts

radMenuItem3.Shortcuts.Add(new Telerik.WinControls.RadShortcut(Keys.Control, Keys.N));

RadMenuItem3.Shortcuts.Add(New Telerik.WinControls.RadShortcut(Keys.Control, Keys.N))

27. Go to the Design View of the form and select the New menu item.

28. In the Properties window, click the events toolbar button.

29. Double-click the Click event.

30. Replace the automatically-generated event handler with this code:

private void radMenuItem3_Click(object sender, EventArgs e)
{
    MessageBox.Show("New File");
}

Private Sub RadMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadMenuItem3.Click
    MessageBox.Show("New File")
End Sub

31. Return to the Design View of the form.

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

See Also