Monday, November 1, 2010

Using Hyperlink in client WPF application

 

As long as hyperlink is not in a page control, should handle “RequestNavigate”:

<TextBlock>
   <Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">Click here!</Hyperlink>
</TextBlock>
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
   System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(e.Uri.AbsoluteUri));
   e.Handled = true;
}