Add an icon image to your WPF project. A 12x12 pixel image is best.
Add the following XAML markup between the <c1:C1MenuItem> and </c1:C1MenuItem> tags, replacing the value of the Source property with your image's name:
Add an icon image to your WPF project. A 12x12 pixel image is best.
Add x:Name="C1MenuItem1" to the item you wish to add an icon to.
Import the following namespace:
Visual Basic
Copy Code
Imports System.Windows.Controls.Image
Example Title
Copy Code
using System.Windows.Controls.Image;
Enter Code view and add the following code beneath the InitializeComponent() method:
Visual Basic
Copy Code
'Create an image and assign it a source, margin, and width
Dim ItemIcon As New Image()
ItemIcon.Source = New BitmapImage(New Uri("02.png", UriKind.RelativeOrAbsolute))
ItemIcon.Margin = New Thickness(5, 0, 0, 0)
ItemIcon.Height = 12
ItemIcon.Width = 12
'Set the C1MenuItem's icon property to the new image
C1MenuItem.Icon = ItemIcon
C#
Copy Code
//Create an image and assign it a source, margin, and width
Image ItemIcon = new Image();
ItemIcon.Source = new BitmapImage(new Uri("02.png", UriKind.RelativeOrAbsolute));
ItemIcon.Margin = new Thickness(5,0,0,0);
ItemIcon.Height = 12;
ItemIcon.Width = 12;
//Set the C1MenuItem's icon property to the new image
C1MenuItem1.Icon = ItemIcon;
Run the project.
The following image depicts a C1MenuItem with a 12x12 pixel icon.