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.

In XAML:

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

In Visual Basic:

' Create menu
Dim menu1 As New XamMenu()
Me.LayoutRoot.Children.Add(menu1)
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

menu1.Items.Add(item)

' 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

menu1.Items.Add(item)

In C#:

// Create menu
XamMenu menu1 = new XamMenu();
this.LayoutRoot.Children.Add(menu1);
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;

menu1.Items.Add(item);

// 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;

menu1.Items.Add(item);

Related Topics

Binding to Data

Layout Settings

Navigating Pages Using xamMenu

Adding and Removing Items

Adding Separators between XamMenuItems

Adding Check Boxes to XamMenuItems