标签:style blog http io color ar os for sp
<Page x:Class="demo.Page1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" WindowTitle="Page1"> <StackPanel Margin="3"> <!--导航到网页,如果导航失败,需要处理在APP.Xaml中处理事件NavigationFailed <TextBlock Margin="3" TextWrapping="Wrap" >This is a simple page. Click <Hyperlink NavigateUri="www.xiepeng.com">Here</Hyperlink> to go to Page2.</TextBlock> --> <!--#btn4表示导航到btn4元素,并不会让其获取焦点--> <TextBlock Margin="3" TextWrapping="Wrap" >This is a simple page. Click <Hyperlink NavigateUri="Page2.xaml#btn4">Here</Hyperlink> to go to Page2.</TextBlock> <Button Margin="2" Padding="2">OK</Button> <Button Margin="2" Padding="2">Close</Button> </StackPanel> </Page>
APP.xaml.cs()
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Windows; namespace demo { /// <summary> /// App.xaml 的交互逻辑 /// </summary> public partial class App : Application { //导航失败处理事件方法 private void Application_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) { if (e.Exception is System.Net.WebException) { MessageBox.Show("Website " + e.Uri.ToString() + " cannot be reached."); e.Handled = true; } } } }
标签:style blog http io color ar os for sp
原文地址:http://www.cnblogs.com/xiepengtest/p/4069293.html