Reputation: 25
I have included a browser control in a WPF app I'm working on and when hyperlinks in the displayed web page are clicked nothing happens. To go to another page I have to right-click on the link and select open. Any ideas why?
Upvotes: 1
Views: 1174
Reputation: 116
I don't know if Syed Shoaib Abidi's answer is just different syntax for the same thing, but:
link.RequestNavigate += UrlClicked;
...
private void Url_Clicked(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
}
Upvotes: 1
Reputation: 2366
I think you need to handle the RequestNavigate
event:
link.RequestNavigate += (sender, e) =>
{
System.Diagnostics.Process.Start(e.Uri.ToString());
};
Reference: C# Hyperlink in TextBlock: nothing happens when I click on it
Upvotes: 2