This is a migrated thread and some comments may be shown as answers.

sub-menu images?

1 Answer 28 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 28 Apr 2011, 03:50 AM
Hi Telerik

I am trying to set the image Index for sub menu items in the items collection of a context menu item.

The ImageIndex property of the sub-menu items does not show the imagelist images associated with the context menu.

How can I get these images to appear on the sub menu items collection?

Regards
Ian Carson

1 Answer, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 29 Apr 2011, 05:10 PM
Hello Ian,

Just retrieve the corresponding item, and get the image from either the menu.ImageList or the image list itself, like so:
var menu = new RadMenu();
var menuItem = new RadMenuItem("Some menuItem");
menu.Items.Add(menuItem);
menu.ImageList = imageList1;
menuItem.ImageIndex = 1;
var subMenuItem = new RadMenuItem("Some submenuItem");
subMenuItem.Image = menu.ImageList.Images[1];
menuItem.Items.Add(subMenuItem);

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
Tags
Menu
Asked by
Ian
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Share this question
or