我创建了一个WPF应用程序。在某个表单中,用户可以将选定的richtextbox文本更改为超链接。我花了一个多小时搜索解决方案,但是找不到。
我的动态超链接是按以下方式创建的:
var textRange = RichTextBox.Selection;
textRange.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue);
var hyperlink = new Hyperlink(textRange.Start, textRange.End)
{
IsEnabled = true,
Foreground = Brushes.Blue
};
hyperlink.NavigateUri = new Uri("http://search.msn.com/" + firstOrDefault.WordId);
var main = new WordMain();
hyperlink.Click += new RoutedEventHandler(main.hyperLink_Click);
RichTextBox.IsDocumentEnabled = true;
RichTextBox.IsReadOnly = false;
如何去除动态超链接的下划线。我想使用文本装饰,但无法通过代码实现。