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

How to center multi-line button caption?

3 Answers 307 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
DerekAlfonso
Top achievements
Rank 1
DerekAlfonso asked on 07 Jun 2010, 12:07 AM
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.

3 Answers, 1 is accepted

Sort by
0
Boryana
Telerik team
answered on 10 Jun 2010, 04:50 AM
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.
0
DerekAlfonso
Top achievements
Rank 1
answered on 10 Jun 2010, 09:03 AM
I am using vb.net and I set the control.text value to be  .Text = "New" + VBNewLine + "Connection" and it still left aligns.

0
Boryana
Telerik team
answered on 15 Jun 2010, 04:38 PM
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.
Tags
RibbonBar
Asked by
DerekAlfonso
Top achievements
Rank 1
Answers by
Boryana
Telerik team
DerekAlfonso
Top achievements
Rank 1
Share this question
or