Getting or Setting HTML Content in DotNetBrowser 1.x

Опубликовано: 09 Ноябрь 2017
на канале: Embedded Browsers
1,374
12

In this tutorial we are talking about getting or setting HTML content in DotNetBrowser.

Get a free 30-days DotNetBrowser trial licence: https://goo.gl/8CMSC1

Previous tutorials:

How to get DotNetBrowser Evaluation Licence:
   • How to get DotNetBrowser Evaluation Licence  

How to Add a Browser Component to WPF Application:
   • How to Add a Browser Component to WPF Appl...  

How to Create HTML UI for WPF Application Using DotNetBrowser:
   • How to Create HTML UI for WPF Application ...  

How to Add a Browser Component to a Windows Forms Application:
   • How to Add a Browser Component to a Window...  

Executing JavaScript from the .NET Side Using DotNetBrowser:
   • Executing JavaScript from the .NET Side Us...  

Injecting a .NET Object into JavaScript Using DotNetBrowser:
   • Injecting a .NET Object into JavaScript Us...  

DotNetBrowser – a Webkit Сontrol for C# WPF and Windows Forms:
   • DotNetBrowser – a Webkit Сontrol for C# WP...  

Transсript:

00:06 First of all we need to create a WPF project, reference the DotNetBrowser library via NuGet and add the license file.

00:12 You can find the detailed instructions in the previous tutorials.

00:15 Next Step is MainWindow Markup.

00:17 Add the DotNetBrowser XML namespace to the MainWindow.

00:24 Create two columns and two rows in the root grid.

00:44 Add the WPFBrowserView to the left side of the window
Specify the initial URL and create the FinishLoadingFrameEvent handler.

01:13 Add the SetHTML Button to the top right cell of the grid, set its name and create the click event handler.

01:32 Add the TextBox to the bottom right cell of the grid. This TextBox will be used for displaying and modifying the HTML content of the BrowserView.

01:51 Now Let`s Implement the MainWindow Behaviour.

01:53 Let’s update the TextBox content.

01:57 Go to the FinishLoadingFrameEvent handler and open the Dispatcher.BeginInvoke instruction.

02:04 Inside the BeginInvoke fill the HtmlTextBox.Text property value with the result of the BrowserView.Browser.GetHTML method.

02:10 This handler will update the text box content every time the browser finishes loading any frame.

02:16 Go to the Button click handler
Inside this handler call the BrowserView.Browser.LoadHTML method and pass the text box content as its argument.

02:25 Build and launch

#DotNetBrowsers
#HTML
#EmbeddedBrowsers