C# Webview导航导致winrt上冻结(非x86)

C# Webview导航导致winrt上冻结(非x86),c#,xaml,windows-runtime,C#,Xaml,Windows Runtime,使用webview.navigate(url)时,整个应用程序都会冻结。这在x86芯片上是显而易见的,但它会使平板电脑完全冻结近50秒 我已经尝试了很多方法来马歇尔线程,但绝对没有什么能让它更好 有什么建议吗 这是xaml和c# 使用制度; 使用System.Collections.Generic; 使用System.IO; 使用System.Linq; 使用Windows基金会; 使用Windows。 使用Windows.UI.Xaml; 使用Windows.UI.Xaml.Controls

使用webview.navigate(url)时,整个应用程序都会冻结。这在x86芯片上是显而易见的,但它会使平板电脑完全冻结近50秒

我已经尝试了很多方法来马歇尔线程,但绝对没有什么能让它更好

有什么建议吗

这是xaml和c#


使用制度;
使用System.Collections.Generic;
使用System.IO;
使用System.Linq;
使用Windows基金会;
使用Windows。
使用Windows.UI.Xaml;
使用Windows.UI.Xaml.Controls;
使用Windows.UI.Xaml.Controls.Primitives;
使用Windows.UI.Xaml.Data;
使用Windows.UI.Xaml.Input;
使用Windows.UI.Xaml.Media;
使用Windows.UI.Xaml.Navigation;
//空白页项模板被记录在http://go.microsoft.com/fwlink/?LinkId=234238
命名空间WebviewSample
{
/// 
///可以单独使用或在框架内导航到的空页。
/// 
公共密封部分类主页面:第页
{
公共主页()
{
this.InitializeComponent();
}
/// 
///当此页面即将显示在框架中时调用。
/// 
///描述如何访问此页的事件数据。参数
///属性通常用于配置页面。
受保护的覆盖无效OnNavigatedTo(NavigationEventArgs e)
{
var itemsList=新列表();
对于(变量i=0;i<300;i++)
{
var listViewItem=new listViewItem{Content=“Click Me!”};
itemsList.Add(listViewItem);
}
listView.DataContext=itemsList;
}
private void ListView_on Selection已更改(对象发送方,SelectionChangedEventArgs e)
{
webView.Navigate(新Uri(“http://online.wsj.com/article/SB10001424127887324299104578529112289298922"));
}
}
}

您可以尝试使用Dispatcher和CoreDispatcherPriority.Low调度导航呼叫,但我认为这不会解决您的问题。看起来您正在尝试创建webbrowser,但不要这样做。看看这篇文章,这只是一个示例应用程序来说明这个问题。我没有尝试创建web浏览器,但我需要能够显示网页。不是所有的时间,而是在必要的时候。此外,当我使用它显示生成的html时,它也会挂起。但没那么糟糕。
<Page
    x:Class="WebviewSample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WebviewSample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <ListView x:Name="listView" ItemsSource="{Binding}" SelectionChanged="ListView_OnSelectionChanged">

            </ListView>
        </Grid>
        <Grid Grid.Column="1">
            <WebView x:Name="webView"></WebView>
        </Grid>
    </Grid>
</Page>



using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace WebviewSample
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var itemsList = new List<ListViewItem>();
            for (var i = 0; i < 300; i++)
            {
                var listViewItem = new ListViewItem {Content = "Click Me!"};
                itemsList.Add(listViewItem);
            }
            listView.DataContext = itemsList;
        }

        private void ListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            webView.Navigate(new Uri("http://online.wsj.com/article/SB10001424127887324299104578529112289298922"));
        }
    }
}