WPF超链接中的文本换行 [英] Text wrapping in WPF hyperlink
本文介绍了WPF超链接中的文本换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的WPF应用程序中,我有:
In my WPF application I have this:
<StackPanel>
<TextBlock>
<Hyperlink>
<TextBlock TextWrapping="Wrap" Name="HyperlinkText" />
</Hyperlink>
</TextBlock>
</StackPanel>
但如果我将 HyperlinkText.Text
设置为一个包裹的长文本,整个文本只在底部加下划线一次(见图)。有没有办法让每一行都单独加下划线而不需要人工包装?
But if I set HyperlinkText.Text
to a long text that wraps, the whole text is underlined only once at the bottom (see image). Is there a way to have every line underlined separately without manual wrapping?
推荐答案
更简单的方法是使用运行而不是TextBlock。
An easier way to achieve that is to use Run instead of TextBlock.
希望它有所帮助。
这篇关于WPF超链接中的文本换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文