Windows 8.1 新增控件之 Hyperlink

本文详细介绍了Windows 8.1中新增的Hyperlink控件的功能和使用方法,包括如何在应用中以特殊颜色显示并实现跳转到指定网址链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文: Windows 8.1 新增控件之 Hyperlink

Hyperlink 控件应该不用过多介绍大家肯定十分清楚其作用,它的功能就像HTML中的<a href=””>标签一样,只不过是在XAML中实现。

使用Hyperlink 标记的文字在应用中会以特殊颜色显示,当用户点击或触碰该文字时就会自动转到NavigateUri 指向的地址链接。如下代码所示:

<TextBlock FontSize="50" FontWeight="Bold">Getting started tutorials for Windows</TextBlock>
<TextBlock FontSize="25" FontWeight="Bold">New to Windows 8.1 or Windows RT 8.1?</TextBlock>
<RichTextBlock FontSize="30" Width="800" HorizontalAlignment="Left">
    <Paragraph>
        You're at the right place. Whether you're brand new to Windows 8.1 or Windows RT 8.1, 
        or just want a refresher,
        <Hyperlink NavigateUri="http://windows.microsoft.com/en-us/windows/how-to?ocid=GA8-1_O_WOL_Hero_Home_HowTo_Pos2_01">
            these 10 tutorials will show you the basics.</Hyperlink>
    </Paragraph>
</RichTextBlock>

我们把段落中一句文字用NavigateUri 指向特定网站链接,链接颜色默认显示为紫色,可以用Foreground 属性调整颜色。

image

点击Hyperlink 后应用会打开网页,如下图所示:

image

关于Hyperlink 的其他属性可参考:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.documents.hyperlink.aspx

posted on 2014-03-08 15:01 NET未来之路 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lonelyxmas/p/3587932.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值