I'm trying to incorporate a WebView2 control in a WinForm application. This application, uses a web browser in multiple pages (tabs, dialog forms) and then I have created a custom control (named WebViewCtrl in my sample code) to incorporate the WebView2 control together with some buttons (address text, go next, go previous and refresh). Until I added the custom control to the main window, all seemed to work fine. When I put the control in a modal dialog window, when I need to close the dialog (named TestDialog) the webView2 control loses is father remaining suspended in the screen.
You can check this behaviour in a very simple working sample that I have loaded in github with the essential code to reproduce the issue:
https://github.com/LeonardoDaga/WebView2-Dialog-Sample
I don't understand if I need to do something to kill the control before I dispose the dialog form. Please help if you have any suggestion.