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 WPF 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.
<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid x:Name="LayoutRoot"> <telerik:RadMenu VerticalAlignment="Top" /> </Grid> </UserControl>
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:RadMenu VerticalAlignment="Top"> <telerik:RadMenuItem Header="Item 1"> <telerik:RadMenuItem Header="SubItem 1" /> <telerik:RadMenuItem Header="SubItem 2" /> </telerik:RadMenuItem> <telerik:RadMenuItem Header="Item 2" /> </telerik:RadMenu>
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.
Take a look at the Styles and Templates section which is entirely dedicated to styling and templating the RadMenu control.
In order to learn how to use the RadMenu and what capabilities it holds, read the various topics that describe its features.