Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 8.1 从代码隐藏添加到内容时,WebView不可见_Windows Phone 8.1 - Fatal编程技术网

Windows phone 8.1 从代码隐藏添加到内容时,WebView不可见

Windows phone 8.1 从代码隐藏添加到内容时,WebView不可见,windows-phone-8.1,Windows Phone 8.1,我有下面的代码,我想做的是用一个新的网格替换用户控件的内容,然后这个网格将承载一个webviewer。如果我测试以下代码,webviewer将不可见 Content = ContentGrid; ContentGrid.VerticalAlignment = VerticalAlignment.Stretch; ContentGrid.HorizontalAlignment = HorizontalAlignment.Stretch;

我有下面的代码,我想做的是用一个新的网格替换用户控件的内容,然后这个网格将承载一个webviewer。如果我测试以下代码,webviewer将不可见

        Content = ContentGrid;
        ContentGrid.VerticalAlignment = VerticalAlignment.Stretch;
        ContentGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
        var rectangle = new Rectangle();
        rectangle.Height = 300;
        rectangle.Width = 300;
        rectangle.Fill = new SolidColorBrush(Colors.Red);

        WebView.Name = "CevaSmecher";
        WebView.VerticalAlignment = VerticalAlignment.Stretch;
        WebView.HorizontalAlignment = HorizontalAlignment.Stretch;
        WebView.Height = 300;
        WebView.Height = 300;
        WebView.Visibility = Visibility.Visible;
        WebView.DefaultBackgroundColor = Colors.Red;

        ContentGrid.Name = "SmecherieRoute";
        ContentGrid.Background = new SolidColorBrush(Colors.BlueViolet);
        ContentGrid.Children.Insert(0, WebView);
然后我用这一行替换最后一行,矩形可见

ContentGrid.Children.Insert(0, rectangle);

我也有同样的问题。我的问题是,在UserControl中,CacheMode被设置为BitmapCache

CacheMode = new BitmapCache();
在我删除这一行之后,出现了WebView