我用c#代码在UWP应用程序中创建了一个webview。我已经给它附加了一个LoadCompleted事件。当此事件触发时,ActaulHeight和ActualWidth为0。我尝试将它的MinWidth和MinHeight设置为500.但它不起作用。
我用XAML创建了一个webview控件,做了同样的事情,但在这种情况下,ActualHeight和ActualWidth是500。
代码如下:
public WebView _webView { get; set; }
public ViewPage()
{
this.InitializeComponent();
_webView = new WebView
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Top,
Source = new Uri(@"https://www.google.com"),
MinHeight = 500,
MinWidth = 500
};
}
private void _webView_LoadCompleted(object sender, NavigationEventArgs e)
{
// Here, when I debug _webview ActualHeight and ActaulWidth is zero.
}https://stackoverflow.com/questions/47652058
复制相似问题