Windows phone 8.1 从代码隐藏添加到内容时,WebView不可见
我有下面的代码,我想做的是用一个新的网格替换用户控件的内容,然后这个网格将承载一个webviewer。如果我测试以下代码,webviewer将不可见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;
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