Reputation: 2623
I hope this is not very stupid question. i have textblock within runs i want to add hyperlink.
Someting like this
<Hyperlink NavigateUri="http://google.com">
<Run Text="http://google.com"/>
</Hyperlink>
I tried different approaches, but every time i had to add hyperlink, an error occurred.
Error 2 [TextElementCollection_TypeNotSupportedInHost]
Arguments:
Debugging resource strings are unavailable.
Often the key and arguments provide sufficient information to diagnose the problem.
Upvotes: 0
Views: 5266
Reputation: 15268
The TextBlock
control does not support Hyperlink
child controls.
You should use a RichTextBox
instead, like this:
<RichTextBox IsReadOnly="True">
<Paragraph>
Displaying text with
<Hyperlink NavigateUri="http://www.google.com" TargetName="_blank">hyperlink</Hyperlink>.
</Paragraph>
</RichTextBox>
Upvotes: 1