Infragistics(R) NetAdvantage(R) : WPF 2012.1
Adding Icons to XamMenuItems
E-mail your feedback on this topic.
Shared XAML > Menus > xamMenu > Using xamMenu > Adding Icons to XamMenuItems

Glossary Item Box

You can display icons next to each menu item in xamMenu or xamContextMenu, giving your end users a visual indication of what the menu item will do. Each XamMenuItem object exposes an Icon property that you can use to set an image.

The following code shows you how to add icons for items in xamMenu.


<ig:XamMenu x:Name="xamMenu1" Height="25" MenuOrientation="Horizontal">
   <!-- TODO: Add menu items-->
   <ig:XamMenuItem Header="Shop">
           <Image Source="Images/Check24.png" />
   <ig:XamMenuItem Header="Checkout">
           <Image Source="Images/ShoppingCart24.png" />

In Visual Basic:

' Create menu
Dim menu1 As New XamMenu()
menu1.Height = 25

' Create Shop menu item
Dim item As New XamMenuItem()
item.Header = "Shop"

Dim image As New Image()
image.Source = New BitmapImage(New Uri("Images/ShoppingCart24.png", UriKind.Relative))
item.Icon = image


' Create CheckOut menu item
item = New XamMenuItem()
item.Header = "CheckOut"

image = New Image()
image.Source = New BitmapImage(New Uri("Images/Check24.png", UriKind.Relative))
item.Icon = image


In C#:

// Create menu
XamMenu menu1 = new XamMenu();
menu1.Height = 25;

// Create Shop menu item
XamMenuItem item = new XamMenuItem();
item.Header = "Shop";

Image image = new Image { Source = new BitmapImage(new Uri("Images/ShoppingCart24.png", UriKind.Relative)) };
item.Icon = image;


// Create CheckOut menu item
item  = new XamMenuItem();
item.Header = "CheckOut";

image = new Image { Source = new BitmapImage(new Uri("Images/Check24.png", UriKind.Relative)) };
item.Icon = image;


Related Topics

Binding to Data

Layout Settings

Navigating Pages Using xamMenu

Adding and Removing Items

Adding Separators between XamMenuItems

Adding Check Boxes to XamMenuItems