文章出處
文章列表
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 屬性調整顏色。
點擊Hyperlink 后應用會打開網頁,如下圖所示:
關于Hyperlink 的其他屬性可參考:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.documents.hyperlink.aspx
文章列表
全站熱搜