WPF textblock加入超链接
<TextBlock Grid.Row="2" Margin="75,0,0,0"> <Hyperlink Name="BlogHl" Click="BlogHl_Click" NavigateUri="http://www.cnblogs.com/ZXdeveloper/">http://www.cnblogs.com/ZXdeveloper/</Hyperlink> </TextBlock>
private void BlogHl_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Process.Start("http://www.cnblogs.com/ZXdeveloper/"); }
-------更新于20160426
<TextBlock> <Run>访问地址:</Run> <Hyperlink NavigateUri="http://www.tax861.gov.cn" RequestNavigate="Hyperlink_RequestNavigate">http://www.tax861.gov.cn</Hyperlink> </TextBlock>
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) { Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; }
在转载时请注明出处(http://www.cnblogs.com/ZXdeveloper/),谢谢。