Is there a way to render WPF controls on top of the wpf WebBrowser control?

后端 未结 6 883
长情又很酷
长情又很酷 2020-12-16 03:51

I need an embedded WebBrowser control in my application, and am having problems displaying WPF content on top of it. The application will sometimes show popups for editing d

6条回答
  •  感动是毒
    2020-12-16 04:07

    The workaround that you could do is by making the height of the web browser control to zero, when some other control comes in front of Web browser control.

    FIX: The standard fix is you can set the height of web browser to zero when you trigger some other control over it depends upon your scenario. Below, there is a sample implementation.

    In MainWindow.Xaml include the events.

    Activated="Window_Activated"
    Deactivated="Window_Deactivated"
    

    In Xaml.cs handle the scenario by setting the height.

    private void Window_Activated(object sender, EventArgs e)
    {
        wb.Height = double.NaN;
    }
    
    private void Window_Deactivated(object sender, EventArgs e)
    {
        wb.Height = 0;
    }
    

提交回复
热议问题