[英]WPF hyperlink in RichTextBox click event
我想將超鏈接添加到RichTextBox,然后在單擊鏈接時導航到另一個窗口。
這就是我所擁有的:
// Add paragraphs to the FlowDocument
Hyperlink link = new Hyperlink();
link.IsEnabled = true;
Paragraph paragraph = new Paragraph();
myFlowDoc.Blocks.Add(paragraph);
link.Inlines.Add(reviewAuthor);
link.Click += new RoutedEventHandler(this.link_Click);
paragraph.Inlines.Add(link);
richTextBox.Document = myFlowDoc;
protected void link_Click(object sender, RoutedEventArgs e)
{
...
}
當我運行該應用程序時,將顯示超鏈接,但是當我單擊它時什么也沒有發生。 永遠不會到達link_click
方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.