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

3 posts, 1 answers
  1. Renbert
    Renbert avatar
    2 posts
    Member since:
    Nov 2014

    Posted 22 Feb Link to this post

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

     

    Thanks..

  2. Answer
    Dess
    Admin
    Dess avatar
    2103 posts

    Posted 23 Feb Link to this post

    Hello Renbert

    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.
  3. Renbert
    Renbert avatar
    2 posts
    Member since:
    Nov 2014

    Posted 23 Feb in reply to Dess Link to this post

    Hi Mam,

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

     

    --Renbert

Back to Top