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

How to center image and text of RadMenuItem when AutoSize is false?

2 Answers 187 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Renbert
Top achievements
Rank 2
Renbert asked on 23 Feb 2017, 12:46 AM

How can I center image and text of RadMenuItem when AutoSize is false? See attached screenshot.

 

Thanks..

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Feb 2017, 08:32 AM
Hello , 

Thank you for writing back. 

Here a sample code snippet demonstrating how to size the RadMenuItem and center the text and image as it is demonstrated in the attached screenshot: 
this.radMenuItem2.AutoSize = false;
this.radMenuItem2.Size = new Size(100, 40);
 
this.radMenuItem2.Layout.TextPanel.AutoSize = false;
this.radMenuItem2.Layout.TextPanel.Size = new Size(80,15);
TextPrimitive txt = this.radMenuItem2.Layout.TextPanel.FindDescendant<TextPrimitive>();
txt.TextAlignment = ContentAlignment.MiddleCenter;
txt.StretchHorizontally = true;
 
this.radMenuItem2.TextImageRelation = TextImageRelation.ImageAboveText;
this.radMenuItem2.ImageAlignment = ContentAlignment.MiddleCenter;


I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Renbert
Top achievements
Rank 2
answered on 24 Feb 2017, 02:29 AM

Hi Mam,

This is great, it's solved my problem. Thank you so much!

 

--Renbert

Tags
Menu
Asked by
Renbert
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Renbert
Top achievements
Rank 2
Share this question
or