Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was having the exact same problem and I couldn't understand why it wasn't working until I ran across <a href="http://www.pitorque.de/MisterGoodcat/post/WP7-snippet-analyzing-the-hyperlink-button-style.aspx" rel="noreferrer">this blog</a> post by <a href="http://www.pitorque.de/MisterGoodcat/author/Mister-Goodcat.aspx" rel="noreferrer">Mister Goodcat</a>. In his post he said that because of some optimizations made for the WP7 in Silverlight the basic functionality that works in normal Silverlight does not work correctly for WP7 Silverlight. Instead of using he suggests modifying the Style instead. </p> <blockquote> <p>The easiest way to edit the default templates still is to use Expression Blend to make a copy of it and work from there. When you do that you'll see that the template really only has a text block to show the content. That is why using another UI element as content doesn't work for the hyperlink button on WP7. If you only want to make the text wrap, it's sufficient to change the TextWrapping property on that text block.</p> </blockquote> <pre><code>&lt;Style x:Key="HyperlinkButtonWrappingStyle" TargetType="HyperlinkButton"&gt; &lt;Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" /&gt; &lt;Setter Property="Background" Value="Transparent" /&gt; &lt;Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}" /&gt; &lt;Setter Property="Padding" Value="0" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="HyperlinkButton"&gt; &lt;Border Background="Transparent"&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="CommonStates"&gt; &lt;VisualState x:Name="Normal" /&gt; &lt;VisualState x:Name="MouseOver" /&gt; &lt;VisualState x:Name="Pressed"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TextElement" /&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Disabled"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="TextElement"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}" /&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;Border Background="{TemplateBinding Background}" Margin="{StaticResource PhoneHorizontalMargin}" Padding="{TemplateBinding Padding}"&gt; &lt;TextBlock x:Name="TextElement" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Text="{TemplateBinding Content}" TextDecorations="Underline" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" TextWrapping="Wrap" /&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>I suggest reading his blog post for more information &amp; help. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload