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

How set margin for Image(icon) in RadContextMenu?

1 Answer 183 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Serg
Top achievements
Rank 1
Veteran
Serg asked on 13 Jan 2021, 02:55 PM

How set margin for Image in RadContextMenu (RadMenuItem)?

Now when setting the image to RadMenuItem, it is too close to the text and left border. How to regulate it?

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 13 Jan 2021, 03:47 PM

Hello, Serg,

You can use the following code snippet in order to give more space between image and text in RadMenuItem:

contextMenu = new RadContextMenu();
(contextMenu.DropDown.PopupElement as RadDropDownMenuElement).Layout.LeftColumnMinWidth = 50;

RadMenuItem menuItem1 = new RadMenuItem("Item 1");
RadMenuItem menuItem2 = new RadMenuItem("Item 2");
menuItem1.Image = Resources.image;
menuItem2.Image = Resources.image;
menuItem1.ImageAlignment = ContentAlignment.MiddleLeft;
menuItem2.ImageAlignment = ContentAlignment.MiddleLeft;

I hope this helps. Should you have any other questions do not hesitate to contact me.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ContextMenu
Asked by
Serg
Top achievements
Rank 1
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or