Webbrowser as background with canvas

I like to add a WebBrowser control as a Canvas background in WPF using C #. How should I do it? At the moment, I have the following code. But does not work.

<Canvas
  Name="canvas"
  Grid.ColumnSpan="4"
  Grid.Row="1"
  MouseDown="Canvas_MouseDown"
  MouseMove="Canvas_MouseMove"
  MouseUp="Canvas_MouseUp"
  Margin="0,0,0,16"
  Grid.RowSpan="3">
  <Canvas.Background>
    <VisualBrush>
      <VisualBrush.Visual>
        <WebBrowser
          x:Name="wbMain"
          Height="246"
          Width="592" />
      </VisualBrush.Visual>
    </VisualBrush>
  </Canvas.Background>
</Canvas>
+3
source share
3 answers

You cannot do this. The web browser control is a wrapper for Internet Explorer ActiveX with emerging airspace issues.

However, you can draw on top of it using the control, <Popup>or if you don't mind losing interactivity, try creating an image of a web page and use it as a Canvas background.

WPF Chrome , :

  • COM-Visible ( javascript no window.external # -)
  • Awesomium, .
  • 10 , Chromium
+1

WebBrowser WPF, . IE. , .

0

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


All Articles