zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    初始MyBatis
    h5调用相机相册
    canvas详解
    js闭包
    Vue和React对比篇
    js造成内存泄漏的几种情况
    js合并对象
    git常用命令小结
    如何隐藏overflow: scroll的滚动条
    js数组sort排序方法的算法
  • 原文地址:https://www.cnblogs.com/gnielee/p/windows8-1-for-developers-hyperlink.html
Copyright © 2011-2022 走看看