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

  • 相关阅读:
    使用Delphi调用条形码控件BarTender打印标签
    我看过的书
    语法规则
    智能家居
    HAL库ADC的DMA采集
    HAL库串口中断接收
    触动心灵的一句话
    摄影技巧
    中国茶道
    单片机延时函数
  • 原文地址:https://www.cnblogs.com/gnielee/p/windows8-1-for-developers-hyperlink.html
Copyright © 2011-2022 走看看