以下是我用于将网络浏览器添加到弹出控件中的代码段,但似乎无效。
Popup codePopup = new Popup();
StackPanel test = new StackPanel();
WebBrowser wb1 = new WebBrowser();
wb1.Navigated += wb1_Navigated;
wb1.Navigate(new Uri(@"http://www.google.com"));
test.Children.Add(wb1);
test.Height = Application.Current.Host.Content.ActualHeight;
test.Width = Application.Current.Host.Content.ActualWidth;
codePopup.Child = test;
this.LayoutRoot.Children.Add(codePopup);
codePopup.IsOpen = true;
答案 0 :(得分:1)
您必须设置web浏览器控件的高度和宽度。