UWP 解决Webview在Pivot里面无法左右滑动的问题

                //为了解决webview在PivotItem里面,阻止pivot左右滑动。
if (webView != null)
{
rootGrid.Children.Remove(webView);
webView.NavigationCompleted -= webView_NavigationCompleted;
webView.NavigationFailed -= webView_NavigationFailed;
webView.NavigationStarting -= webView_NavigationStarting;
webView.DOMContentLoaded -= webView_DOMContentLoaded;
webView.ScriptNotify -= webView_ScriptNotify;
} webView = new WebView(WebViewExecutionMode.SameThread);
webView.SetValue(Grid.RowProperty, );
webView.Visibility = Visibility.Collapsed;
webView.NavigationCompleted += webView_NavigationCompleted;
webView.NavigationFailed += webView_NavigationFailed;
webView.NavigationStarting += webView_NavigationStarting;
webView.DOMContentLoaded += webView_DOMContentLoaded;
webView.ScriptNotify += webView_ScriptNotify;
rootGrid.Children.Add(webView);

标红的部分是必须的。解决方案就是手动加入webview并且使用

WebViewExecutionMode.SameThread
上一篇:python对象序列化pickle


下一篇:KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架之koahub-yilianyun