Reputation: 51
How can I create a hyper link in C# code that looks like the following in XAML?:
<TextBlock>
<Hyperlink Click="HyperLinkClick">New Hyperlink</Hyperlink>
</TextBlock>
Upvotes: 2
Views: 6177
Reputation: 217411
MSDN usually has very good examples. Combining the examples for TextBlock and Hyperlink:
TextBlock textBlock1 = new TextBlock();
Run run3 = new Run("Link Text.");
Hyperlink hyperl = new Hyperlink(run3);
hyperl.NavigateUri = new Uri("http://search.msn.com");
textBlock1.Inlines.Add(hyperl);
Upvotes: 4