No icon shown in sfDiagram context menu

I would like to add a custom command with an icon to the context menu of the SfDiagram, but when I try to set the icon to the image that is stored in the images folder of the application, no icon is shown. See my code:

DiagramMenuItem menu = new DiagramMenuItem()
{
    Content = "Open module",
    Command = new DelegateCommand(Open_Module),
    Icon = "images/open.ico"
};
MainDiagram.Menu.MenuItems.Add(menu);

What am I doing wrong?

1 Reply 1 reply marked as answer

KR Karkuvel Rajan Shanmugavel Syncfusion Team May 12, 2021 06:15 AM UTC

Hi Joost, 
 
Thanks for using Syncfusion products. 
 
Requirement: Need to show icon in  the SfDiagram’s ContextMenu. 
 
We can achieve your requirement in our SfDiagram control. Please refer the following code example to achieve your requirement. 
 
 
            DiagramMenuItem item = new DiagramMenuItem() 
            { 
                Content = "Delete", 
                Command = DiagramCommands.Delete, 
                Icon = @"pack://application:,,,/Asset/Delete.png", 
            }; 
 
            Diagram.Menu.MenuItems.Add(item); 
 
 
 
For your convenience we have also created a sample that can be downloaded from the following link 
 
 
Regards, 
Karkuvel Rajan S 


Marked as answer
Loader.
Up arrow icon