Add HyperLink programmatically in WPF.

  • Posted by: Softree Technology

[code lang=”c”]
Label linkLabel = new Label();

Run linkText = new Run(“(” + displayName+ “)”);

Hyperlink link = new Hyperlink(linkText);

link.NavigateUri = new Uri(“http://url”);

link.RequestNavigate += new RequestNavigateEventHandler(delegate (object sender, RequestNavigateEventArgs e)

{

Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));

e.Handled = true;

});

linkLabel.Content = link;

[/code]

Author: Softree Technology

Leave a Reply