Make WPF control over a web browser

I have a WPF application in which I have a built-in web browser control. I want to show animation through a web browser at a specific time, but the problem is that the WPF controls when they are stored in a web browser are not visible.

Is there a way to show my user control over a web browser?

+4
source share
3 answers

Please answer me first

WinFormHost this web browser control the WPF Web Browser Control or Winform WPF Web Browser control hosted in WinFormHost ?

To have a WPF control display an animation above it, you explored ...

  • Placing your control in a Grid or Canvas , and then placing the stretched Border (in which the animation is running in it) as the last child of the grid / canvas?
  • Adorner with a constantly changing drawing context to simulate animation?
  • A transparent Popup with animation whose static placement (tied to control the absolute left, top, and actual height and width properties) over the control?

Try a transparent popup approach for managing your web browser ...

  <Grid> <WebBrowser x:Name="WebBrowser1"/> <Popup IsOpen="{Binding StartAninmation}" AllowsTransparency="True" Grid.RowSpan="99" Grid.ColumnSpan="99" Placement="Center" Width="{Binding ActualWidth, ElementName=WebBrowser1, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=WebBrowser1, Mode=OneWay}" PlacementTarget="{Binding ElementName=WebBrowser1}" Opacity="0.5" Margin="3"> <TextBlock Text="Loading ..."/> </Popup> </Grid> 

One of them will certainly work in your case.

+2
source

Unfortunately, this is not possible with WPF Webbrowser Control (which is basically a wrapped WinForms WebBrowser control) because the OS displays WinForms and WPF content.

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

There is a third-party Awsomium application that should make this possible.

Edit: Another possibility is to make a frameless window above the WebBrowser control. But it is a little difficult to keep in the right position / z-order.

+1
source

CefSharp provides a clean version of the WPF browser based on Chromium / V8, which is not affected by the airspace issues of the Microsoft WebBrowser control (disclaimer: I am a supporter of CefSharp).

+1
source

Source: https://habr.com/ru/post/1395556/


All Articles