WPF Frame Management

I have a WPF application that contains a Frame control. The frame control displays html content. Is there a JavaScript function on the html page that I want to call after the html page is loaded into Frame and from WPF code? Is there a way that I can call the JavaScript method of the html page loaded into the WPF frame control and from the WPF code?

+2
source share
3 answers

You cannot interact with HTML inside a frame. To interact with HTML, you can use WPF WebBrowser to control .NET 3.5 SP1.

You can see the action in this video in the WebBrowser control:

http://channel9.msdn.com/posts/AdamKinney/WPF-35-SP1-App-Model-with-Jennifer-Lee/

+3

DOM, . - , WinForms WebBrowser System.Windows.Forms.

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:f="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" 
  xmlns:fi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration.dll" >
  <Grid>  
    <fi:WindowsFormsHost>
      <f:WebBrowser x:Name="BrowserControl" Url="http://www.myurl.com/"/>
    </fi:WindowsFormsHost>
  </Grid>
</Page>
+1

<body onload="javascript:alert('hi its loaded. do what you want here');"> HTML-, myhtmlpage.html.

XAML (<Frame Name="myWpfFrame" Source="http://myurl/myhtmlpage.html">) WPF.


, javascript thats HTML.

js , ... . myWpfFrame.Source = myWpfFrame.Source;

0
source

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


All Articles