wpf跳转网页
如果是本地磁盘上的网页,可以考虑利用操作系统的文件关联自动调用操作系统默认浏览器:
System.Diagnostics.Process.Start("explorer.exe", "file:///" + htmlFilePath); //不能用destUri.AbsoluteUri,因为会进行URL转码导致找不到文件;
//如果不想调用外部浏览器,而是想在WPF程序本身预览本地磁盘上的某个网页,可以这样:
//先在窗口上放置一个Frame,起个名字叫previewFrame,然后
var destUri = new Uri("file:///" + htmlFilePath);
previewFrame.Source = destUri;
previewFrame.Refresh();
//file:///也是个协议的标志,一般网页改成http://呀、https://呀、ftp://呀啥的