WebView.Source 和 WebView.Navigate 有什么区别? [英] What are the differences between WebView.Source and WebView.Navigate?
问题描述
在文档中声明我们应该从代码中使用 WebView.Navigate
,但我想了解原因.有什么区别?
In documentation it is stated that we should use WebView.Navigate
from code, but I want to understand why. What are the differences?
推荐答案
根据我的测试,这两种方法在导航方面似乎没有任何区别 - 两者都创建了一个历史条目(所以 GoBack
工作正常),两者都支持 HTTP/HTTPS URI 以及使用 ms-appdata:
和 ms-appx:
协议的本地文件.
As per my tests there does not seem to be any difference between these two approaches in terms of navigation - both create a history entry (so GoBack
works properly), both support HTTP/HTTPS URI as well as local files using ms-appdata:
and ms-appx:
protocols.
我能想到的唯一区别是 Source
允许您读回当前显示的 URI(除了设置它)并且它支持数据绑定,因此您可以使用它以 MVVM 方式.
The only difference I can think of then is the fact that Source
allows you to read back the currently displayed URI (in addition to setting it) and it supports data-binding, so you can use it in MVVM manner.
这篇关于WebView.Source 和 WebView.Navigate 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!