How to center multi-line button caption?

4 posts, 0 answers
  1. DerekAlfonso
    DerekAlfonso avatar
    16 posts
    Member since:
    Feb 2010

    Posted 06 Jun 2010 Link to this post

    Hi

    I have created a radButtonElement in a ribbonbar group.
    The text of the button is "New Connection", I want this text to be on 2 lines, and want it centered.
    Right now I can get the caption in 2 lines by using "<html>New<br />Connection</html>" in the property Text.
    However this is always left aligned when shown in screen.
    Eg. like below
    <Icon>
    New
    Connection

    How can I make New Connection centered, not default to left align?

    The image attached is the rabButton in the radRibbonBar.  It is left aligned but I want it centered.
  2. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 09 Jun 2010 Link to this post

    Hi Bill Vanderpol,

    Thank you very much for contacting us.

    When you set the TextAlignment property of the RadButtonElement the text should be positioned appropriately. This implies that the text should not be aligned to the left when the value of the property is MiddleCenter. Our team would like to thank you for spotting and reporting this issue. It will be referred in the future releases. At the moment I can suggest you the following workaround: instead of using the MarkupEditor you can set the Text property of the RadButtonElement using \n. Further, you can set the TextAlignment property of the TextElement to MiddleCenter. Here is a sample code that sets the properties:

    this.radButtonElement1.TextElement.TextAlignment = ContentAlignment.MiddleCenter;
    this.radButtonElement1.Text = "New\nConnection";

    Thank you once again for your cooperation and understanding. I have updated your Telerik points. Please let me know if you experience any further issues.

    Best wishes,
    Boryana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. DerekAlfonso
    DerekAlfonso avatar
    16 posts
    Member since:
    Feb 2010

    Posted 10 Jun 2010 Link to this post

    I am using vb.net and I set the control.text value to be  .Text = "New" + VBNewLine + "Connection" and it still left aligns.

  5. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 15 Jun 2010 Link to this post

    Hello Bill Vanderpol,

    Thank you for your answer. Please try adding the following line to your code:
    Me.RadButtonElement1.TextElement.TextAlignment = ContentAlignment.MiddleCenter

    I hope you find it useful. In case this does not help, please open a new support ticket and send us a sample project. Thus we will be able to assist you further. I am looking forward to your reply.

    Sincerely yours,
    Boryana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top