0

我希望这不是一个非常愚蠢的问题。我在运行中有文本块我想添加超链接。

有点像这样

<Hyperlink NavigateUri="http://google.com">
<Run Text="http://google.com"/>
</Hyperlink>

我尝试了不同的方法,但每次我必须添加超链接时,都会发生错误。

Error 2 [TextElementCollection_TypeNotSupportedInHost] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem.

4

1 回答 1

1

TextBlock控件不支持Hyperlink子控件。您应该使用 aRichTextBox代替,如下所示:

<RichTextBox IsReadOnly="True">
    <Paragraph>
        Displaying text with
        <Hyperlink NavigateUri="http://www.google.com" TargetName="_blank">hyperlink</Hyperlink>.
    </Paragraph>
</RichTextBox>
于 2012-10-09T14:59:30.733 回答