Text Wrapping a WP7 HyperlinkButton

If you have ever used a HyperlinkButton in your WP7 app, you will notice that the “TextWrapping” property is not available to that control. What happens if you have a HyperlinkButton with a really long name is, it gets truncated as such.

truncated HyperlinkButton

You can set the text to wrap though by generating your own custom style, where you get to have more control of the text in the HyperlinkButton .

 
First open up your page in Expression Blend

open in blend

 
Once Expression Blend is opened, right click on the HyperlinkButton and select “Edit Template – Edit a Copy”.

edit template

 
You will now notice that on the left hand corner, after expanding the tree, you get to a TextElement control. Select that and then expand the “Text” option on the right.

text option

 
After expanding the “Text” option, you can now set the TextWrapping option.

textwrapping

 
Save the project and you’re done. You can now close Expression Blend. In Visual Studio, you will notice a new style has been added to your XAML at the top.

style

 
And there you have it, your HyperlinkButton is now text wrapped.

text wrap

You can leave a response, or trackback from your own site.

One Response to “Text Wrapping a WP7 HyperlinkButton”

  1. Jeremy says:

    Hi Adi! Great site on WP7 apps. Thought you might be interested in this contest: “develop a wp7 app and win a nokia lumia 800″ See http://www.movend.com/wp7challenge for details. =)

Leave a Reply


8 + seven =