首页 > Windows开发 > 详细

WPF超级链接

时间:2014-10-11 09:41:26      阅读:322      评论:0      收藏:0      [点我收藏+]

一、添加样式

<Style x:Key="LinkLabelStyle">   
<Setter Property="Control.Padding" Value="0" />
<Setter Property="Control.VerticalAlignment" Value="Center" />
</Style>
二、Xaml标记
<Label Canvas.Left="29"  Canvas.Top="320" x:Name="productLink" x:Uid="productLink" Style="{StaticResource LinkLabelStyle}" >    
<Label.Content>
<Hyperlink x:Name="hyperlink" x:Uid="hyperlink" NavigateUri="http://www.mtdzsp.com" Style="{StaticResource LinkLabelStyle}" Hyperlink.RequestNavigate="hyperlink_RequestNavigate">
<TextBlock Text="更多" Foreground="Black"/>
</Hyperlink>
</Label.Content>
</Label>


三、代码

     private void hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            if (e.Uri != null && string.IsNullOrEmpty(e.Uri.OriginalString) == false)
            {
                string uri = e.Uri.AbsoluteUri;
                Process.Start(new ProcessStartInfo(uri));
                e.Handled = true;
              
            }
        }

 

WPF超级链接

原文:http://www.cnblogs.com/OnlyVersion/p/4018344.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!