New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem when changing WebView2 control’s parent visibility #1094
Comments
Hey @Lukasz736 - you may need to call WebView2.Show() if the Canvas isn't automatically calling Show/Hide on it's children. Can you give that a try? |
We don't see available method Show() in WebView2 control. We tried to manipulate with Visibility property, but without possitive result. |
I was able to repro using your app and have added this bug to our backlog to debug further. If you drag the window, does it show up properly? I wasn't able to repro if I changed the visibility using a button instead of a timer, so I wonder if the user interaction helps there. Depending on why you are hiding and then showing it, you can try listening to the WebView2 loading events (for example, WebView2.NavigationCompleted) to show it when ready instead of a timer, but I'm not sure if that runs into the same issue. |
I was able to workaround this issue easily by adding |
This workaround solve our problem with visibility of HTML document. |
I think I'm having a related issue to this. I'm running WinUI If the parent container goes from collapsed to visible, the view is rendered, but is not interactive (scrolling, clicking, etc. is all ignored). The web view is able to be resized and it correctly updates the layout, etc. I don't see any |
Hey @kitgrose - for WinUI 2 issues, you can start with the WinUI repo: |
Our development:
SDK: 1.0.705.50/1.0.774.44
Runtime: Canary 91.0.830.0 x64
Framework: .NET Core 3.1, WPF, x64
OS: Windows 10 Pro x64
We have simple problem when we change visibility of WebView2 control's parent with WebView2 and Edge Canary. In WPF we put Canvas on Grid and on Grid we have WebView2 control. Canvas has Visibility = Hidden, like below:
After that we load sample HTML document, when application starts, Canvas is hidden:
After few seconds, we change Canvas Visibility to true:
Our result:
https://pagspzoo-my.sharepoint.com/:i:/g/personal/lukasz_kozek_pag_com_pl/EabQlEZxS_lFjNZVeXvdIDkBtlQ4MglClzCnfSDpnNRGYQ
We don’t see HTML document, only gray field. When we minimize and maximize main window, HTML shows. Grey field we can see in 1.0.705.50 of WebView2 version.
When we upgarde this control to 1.0.774.44 version, we don’t see grey field, only Grid with Aqua color. We have the same situation like above, after minimize and maximize main window, HTML shows.
Below I share source of sample application. First, with older version WebView2 and grey field, and newest version.
Source with 1.0.705.50 (gray field)
https://pagspzoo-my.sharepoint.com/:u:/g/personal/lukasz_kozek_pag_com_pl/EQMNEObCCsZMmUzm7QztIQcBTxxgkLMRiEgDRuVDVWprkg?e=h8lHBf
Source with 1.0.774.44
https://pagspzoo-my.sharepoint.com/:u:/g/personal/lukasz_kozek_pag_com_pl/ESsadCGN0zJOpTB03KaJ0iYBCJ4LvjjbNwBDNUQ1zwpTqQ?e=GTx0Ns
Thank You for any advice.
AB#32255210
The text was updated successfully, but these errors were encountered: