WebView2 Class

The WebView2 class is a form control allows you to duplicate the functionality of Microsoft's Edge browser inside of an EasyLanguage Application. For example, by adding a WebView2 control to a form you can display external web resources and data including news stories and video, interactive tutorials, trading chat room access, and custom dashboards. Additionally, this control will allow you to create HTML commentary, similar to the existing Analysis Commentary, but with much more flexibility and fewer restrictions.

Use of this control follows the same pattern as other EasyLanguage WinForm controls. The control must be created prior to use by calling the Create method. Once created, it can be added to a WinForm using the AddControl method.

The WebView2 control includes features such as navigating to a URL, reloading a web page, and moving backwards and forwards through navigation history. Additionally, navigation, document loading, and other events can be monitored (see the Events section, below).

Namespace: elsystem.windows.forms

Properties

   Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).

  Name Type Description
Public property AllowDrop bool True if the control will navigate to documents dropped onto it.
Public property CanGoBack bool True if the control can navigate backward to a previous page (if history available) using the GoBack method.
Public property CanGoForward bool True if the control can navigate forward to a subsequent page (if history available) using the GoForward method.
Public property DefaultBackgroundColor object Gets or sets the default background color of the WebView2 control.
Public property Font object Not a user property. Reserved for future use.
Public property Source string Gets or sets the address of the the top level document of the WebView2 control. Setting this property is equivalent to calling NavigateToString.
Public property Text string Not a user property. Reserved for future use.
Public property ZoomFactor double Gets or sets the zoom factor of the control. Default value is 1.0 (no zoom).
Methods
  Name Description
Public property Create Initializes a new instance of the control.   
Public property Create (width,height) Initializes a new instance of the control.   Parameters include the Width and Height of the control.
Public property ExecuteScriptAsync( script ) Runs the provided script in the WebView2 control.
Public property GoBack Navigates the WebView2 to the previous page in the navigation history, if one is available.
Public property GoForward Navigates the WebView2 to the next page in the navigation history, if one is available.
Public property NavigateToString(string) Renders the HTML that is provided as a string parameter. Note that the string must be valid HTML, rather than simple text.
Public property Reload Reloads the document currently displayed in the WebView2 by checking the server for an updated version.
Public property Stop Cancels any pending navigation and stops any dynamic page elements, such as background sounds and animations.
Events
  Name Description
Public event CoreWebView2InitializationCompleted Occurs when the control has finished initialization or when an attempt to initialize the control fails. See WebView2CoreWebView2InitializationCompletedEventArgs for the properties returned by the handler's args parameter.
Public event ExecuteScriptDone Occurs when the control completes execution of the script specified in a call to ExecuteScriptAsync(). See ExecuteScriptDoneEventArgs for the properties returned by the handler's args parameter.
Public event NavigationCompleted Occurs when the control completes rendering of a document, whether the rendering is successful, or not. See WebView2NavigationCompletedEventArgs for the properties returned by the handler's args parameter.
Public event NavigationStarting Occurs when an attempt to navigate to a new document begins. See WebView2NavigationStartingEventArgs for the properties returned by the handler's args parameter.
Public event SourceChanged Occurs when the control's Source property changes. See WebView2SourceChangedEventArgs for the properties returned by the handler's args parameter.
Public event WebMessageReceived Occurs when web content sends a message to the application host using chrome.webview.PostMessage. See WebView2WebMessageReceivedEventArgs for the properties returned by the handler's args parameter.
Public event ZoomFactorChanged Occurs when the control's ZoomFactor property changes. This event does not fire when the ZoomFactor is changed by the code that created the WebView2 control. See EventArgs for the properties returned by the handler's args parameter.