-
Notifications
You must be signed in to change notification settings - Fork 51
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
Hiding the parent form does not hide webview2 control #1079
Comments
Hey @RalphLAtGitHub - I'm not familiar with MDI forms specifically. The visibility of the web content is tied to the WebView2 control's Visibility. When I try to repro with a regular form and call hide on the form, the form calls Hide() on the children (or sets .Visible = false), which our control then forwards to the web content to tell it to hide. It's possible the MDI form doesn't automatically tell the children to hide? When your MDI form is hiding, can you try calling |
Hi @champnic: Of course, The only "solution" that I have found so far is to close the form containing the WebView2 control via You can find a demo here: https://github.com/RalphLAtGitHub/WebView2-MDI Unfortunately, I have to create the form containing the WebView2 control (asynchronously) in advance, because I have not yet succeeded in creating it synchronously in WinForms (see #1065). Thanks in advance for your support! |
Thanks for the repro app @RalphLAtGitHub, I took a quick look at it. It doesn't look like the WebViewForm is being added as a child of the Form1 unless I'm missing something? Typically the expectation is that the parent cleans up it's children, or in this case, calls Hide on all children when closing. If the WebView2 is a child of the Form1 then this should happen automatically. |
@champnic: The WebViewForm is (according to the documentation) added as a MDI child in the ctor of Form1: |
Thanks for confirming - the integration with MDI is new to me and not a scenario we've specifically tested, so it's definitely possible we aren't handling a window message we should be. Our control overrides OnVisibleChanged (as a result of Show()/Hide()/Visible = x or other code paths) to tell the CoreWebView2 to show or hide. I can open a bug on our backlog to debug more in depth, but we probably won't be able to look at this for a while. So I would suggest looking into any workaround that would allow propagating the .Visible/Hide()/Show() to the WebView2 control. |
Hi @champnic, I am happy to be able to make a small contribution. I fully understand the prioritization - there are enough more important things to do. I think everyone is eagerly awaiting a version of the WebView2 control that we can deploy to our users. I wish you and your team much success! |
Thanks @RalphLAtGitHub - we appreciate the kind words :) |
Ours is also an MDI application (granted, WinForms) in .NET, but I haven't extended the |
This should be fixed in 1.0.902-prerelease SDK. Thanks! |
Description
Hiding the parent form does not hide WebView2 control but shows it at the origin of the screen.
Repro Steps
Create a MDI form and child with WebView2 inside. Hide MDI child programmatically.
Screenshots
![MDI_1](https://user-images.githubusercontent.com/34791469/111329430-6a6dba80-866f-11eb-8a80-d220df630691.JPG)
![MDI_2](https://user-images.githubusercontent.com/34791469/111329450-6d68ab00-866f-11eb-91a2-56e43d7dbbc6.JPG)
Einvironment
Windows 10 Pro 20H2 Build 19042.844
Visual Studio 16.9.1
.NET 5.0.4 WindowsDesktop
Edge 89.0.774.50
WebView2 1.0.774.44
AB#32237299
The text was updated successfully, but these errors were encountered: