RadMenu is an advanced control providing full Expression Blend support. From within the visual environment of Expression Blend, you can easily perform various tasks such as editing control properties, modifying themes, creating and modifying templates and more.
This tutorial will walk you through the creation of a RadMenu and will show you how to:
Before reading this tutorial you should get familiar with the Visual Structure of the standard RadMenu control.
For the purpose of this tutorial, you will need to create an empty Silverlight Application project and open it in Expression Blend.
In order to use RadMenu control in your projects you have to add references to the following assemblies:
Open the Asset Library (Window->Assets) in Expression Blend and start writing the name of the RadMenu in the search box.
Drag a RadMenu on the artboard.
<telerik:RadMenu VerticalAlignment="Top" />
There are two things you should pay attention to in the above code snipped. The first is the declaration of the Telerik.Windows.Controls namespace from Telerik.Windows.Controls.Navigation assembly and the second is the declaration of the RadMenu control itself. If you run your application now you will see an empty RadMenu that contains no items.
Add Menu Items
The class that represents the menu item is Telerik.Windows.Controls.RadMenuItem.
Select your control in Expression Blend. In the Properties Pane, find and edit the Items property.
The "Object Collection Editor" dialog will open.
Add two items of type RadMenuItem.
Set their Header properties respective to Item 1 and Item 2.
These items can have child items on their own. To add items to one of them, select it in the 'Objects and Timeline' pane.
Repeat the same steps as by the RadMenu.
Here is a snapshot of the result and the respective XAML code, generated by Expression Blend.
<telerik:RadMenuItem Header="Item 1">
<telerik:RadMenuItem Header="SubItem 1" />
<telerik:RadMenuItem Header="SubItem 2" />
<telerik:RadMenuItem Header="Item 2" />
Populating the RadMenu with Data
The scenario described in the previous sections shows the usage of static items. To learn more about these type of scenarios read here.
However, in most of the cases you have to bind your RadMenu to a collection of business objects. Check out the following topics which describe in details how to work with dynamic data.
- Data Binding Support Overview - describes the various data sources for the RadMenu and shows you many tips and tricks. Read this topics in order to achieve basic knowledge about how the binding mechanism works at the RadMenu.
- Binding to Dynamic Data - shows you how to bind the RadMenu to a collection of business objects.
- Template and Styles Selectors - describes the possibilities to adjust the appearance of the RadMenu's items depending on the data they hold.
Styles and Templates
Take a look at the Styles and Templates section which is entirely dedicated to styling and templating the RadMenu control.
Work with the RadMenu
In order to learn how to use the RadMenu and what capabilities it holds, read the various topics that describe its features.