【发布时间】:2014-11-15 04:10:47
【问题描述】:
我的代码在每个链接之前添加了一个换行符。如何在不添加换行符的情况下添加超链接?这是我的代码:
String link = "http://google.de";
if (Uri.IsWellFormedUriString(link, UriKind.RelativeOrAbsolute))
{
Paragraph paragraph = new Paragraph();
paragraph.Inlines.Add(link);
Hyperlink hyper = new Hyperlink(paragraph.ContentStart, paragraph.ContentEnd);
hyper.NavigateUri = new Uri(new TextRange(paragraph.ContentStart, paragraph.ContentEnd).Text);
paragraph.Margin = new Thickness(0);
richTextBox1.Document.Blocks.Add(paragraph);
}
【问题讨论】:
标签: c# wpf hyperlink richtextbox