在WPF应用中添加超链接

转载于:http://nishantrana.wordpress.com/2009/03/26/using-hyperlink-in-wpf-application/

To user hyperlink in WPF application we could do something like this


  
    Click Here
  

  

However the NavigateUri works only if we are placing the hyperlink within a page. To use it within a windows-based application we need to hanlde the RequestNavigate event and write the code ourselves.

Something like this

 
  
    Click here
  

  

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
  {
            Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
            e.Handled = true;
  }

While using hyperlink we could also provide handler for Application.NavigationFailed event in case if navigation fails.

That’s it ….

转载于:https://www.cnblogs.com/MarcLiu/p/3723020.html

你可能感兴趣的:(php)