学用Windows Phone 8中Hyperlink和Command

偶然得知,Windows 8.1中把Hyperlink加到了XAML中去了,这使我想到Windows Phone中也早已把相同的元素加进去,但是罕有文档说明。 接下来,我将演示一下,如何在Windows Phone 8中通过Hyperlink来实现导航和激活事件。 首先,我们需要在Visual Studio中新建一个Windows Phone的工程,并加入以下XAML: 1: <TextBlock x:Name=”tb1″></TextBlock> 2: <RichTextBox> 3: <Paragraph> 4: <Hyperlink>First Link</Hyperlink> 5: Some Text 6: <Hyperlink>Second Link</Hyperlink> 7: </Paragraph> 8: </RichTextBox> 现在,按下F5启动调试,这里我们能看到界面中有两个超链接存在。下面,我们在一个链接中加URL,在另外一个链接中添加一个事件。 1: <TextBlock x:Name=”tb1″></TextBlock> 2: <RichTextBox> 3: <Paragraph> 4: <Hyperlink NavigateUri=”/Page1.xaml”>First Link</Hyperlink> 5: Some Text 6: <Hyperlink Click=”Hyperlink_Click”>Second Link</Hyperlink> 7: </Paragraph> 8: </RichTextBox> 最后,我们演示一下Hyperlink.Command。这个Command是一个激活动作,而不是一个绑定在按钮上的事件。在这里,我们需要给它绑定一个动作: 1: <TextBlock…

0

Beginning with Hyperlink and Command in Windows Phone

Occasionally read the XAML control changes for Store App development in Windows 8.1, an interest thing notified me is that Windows 8.1 adds the Hyperlink element to XAML text object model, which recalled me that the same element has been added into Windows Phone already, but with less documents for its use. In the following…

0