How to change Hyperlink text from code behind?? RRS feed

  • Question

  •  I would like to change hyperlink text from code behind..but could not find any way to do this...?

    <TextBlock Margin="0,0,4,-5" Height="25" Foreground="Blue" Name="lblSearchResult"

    TextDecorations="Underline" HorizontalAlignment="Right"

    FontSize="10" Opacity="2" Visibility="Hidden" VerticalAlignment="Bottom" Width="100">

    <Hyperlink Name="MyHyperLink" PreviewMouseDown="lblSearchResults_MouseDown" >157 Search Results</Hyperlink>


    code behind
    MyHyperLink.<WHICH Property to use???> ="12 serach results";

    Pa Ji

    Thursday, June 12, 2008 3:11 AM


  • I don't think you can do this by setting a single property, because a Hyperlink can potentially contain multiple runs of text.  Instead, try the following:

    Run run = new Run("12 search results");

    You might also want to consider bringing out the number of search results into a separate element and databinding that element.
    • Marked as answer by BS-786 Thursday, June 12, 2008 2:11 PM
    Thursday, June 12, 2008 4:01 AM