简体   繁体   中英

How to display links in TextBlock?

I want to show a long list of reviews which may contain links. how can I show them so the user can click and open links?

this question has been asked a lot, but I couldn't find a functional answer, this obsolete answer seems isn't working:

<TextBlock>
  <Run>let me</Run>
  <Hyperlink NavigateUri="http://www.google.com">google</Hyperlink>
  <Run>that for you</Run>
</TextBlock>

Also RichTextBox doesn't support Data Binding does it?

reviews will be shown inside a LongListSelector like this:

<phone:LongListSelector ItemsSource="{Binding Reviews}">
    <phone:LongListSelector.ItemTemplate>
        <DataTemplate>
            <TextBlock Text={Binding Review}/>
        </DataTemplate>
    </phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>

You are missing Text Property,

Here is a complete example of how to add links inside RichTextBox Hyperlink inside rich textbox

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM