Reputation: 4571
I want to add a hyperlink to a RichTextBox, then navigate to another window when the link is clicked.
This is what I have:
// 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)
{
...
}
When I run the application, the hyperlink is displayed, but nothing happens when I click on it. The link_click
method is never reached.
Upvotes: 1
Views: 1982