Loading

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;
 }

 

posted @ 2014-08-15 12:39  眾尋  阅读(2278)  评论(0编辑  收藏  举报