Share via


WebViewControl Class

Definition

This class is an implementation of an IWebViewControl.

public ref class WebViewControl sealed : IWebViewControl
public ref class WebViewControl sealed : IWebViewControl, IWebViewControl2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 393216)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class WebViewControl final : IWebViewControl
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 393216)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class WebViewControl final : IWebViewControl, IWebViewControl2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 393216)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class WebViewControl : IWebViewControl
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 393216)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class WebViewControl : IWebViewControl, IWebViewControl2
Public NotInheritable Class WebViewControl
Implements IWebViewControl
Public NotInheritable Class WebViewControl
Implements IWebViewControl, IWebViewControl2
Inheritance
Object Platform::Object IInspectable WebViewControl
Attributes
Implements

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)

Remarks

Version history

Windows version SDK version Value added
1809 17763 AddInitializeScript
1809 17763 GotFocus
1809 17763 LostFocus

Properties

Bounds

Gets or sets the bounds of the control.

CanGoBack

Gets a value that indicates whether there is at least one page in the backward navigation history.

For more info, see Windows.Web.UI.IWebViewControl

CanGoForward

Gets a value that indicates whether there is at least one page in the forward navigation history.

For more info, see Windows.Web.UI.IWebViewControl

ContainsFullScreenElement

Gets a value that indicates whether the control contains an element that supports full screen.

For more info, see Windows.Web.UI.IWebViewControl

DefaultBackgroundColor

Gets or sets the color to use as the control background when the HTML content does not specify a color.

For more info, see Windows.Web.UI.IWebViewControl

DeferredPermissionRequests

Gets a collection of permission requests that are waiting to be granted or denied.

For more info, see Windows.Web.UI.IWebViewControl

DocumentTitle

Gets the title of the page currently displayed in the control.

For more info, see Windows.Web.UI.IWebViewControl

IsVisible

Gets or sets a value that indicates if this control is invisible.

Process

Gets the process that the control is hosted in.

Scale

Gets or sets the scale of the window.

Settings

Gets a WebViewControlSettings object that contains properties to enable or disable IWebViewControl features.

For more info, see Windows.Web.UI.IWebViewControl

Source

Gets or sets the URI source of the HTML content to display in the control.

For more info, see Windows.Web.UI.IWebViewControl

Methods

AddInitializeScript(String)

Injects a script into a WebViewControl just after ContentLoading but before any other script is run on the page.

BuildLocalStreamUri(String, String)

Creates a URI that you can pass to NavigateToLocalStreamUri

For more info, see Windows.Web.UI.IWebViewControl

CapturePreviewToStreamAsync(IRandomAccessStream)

Creates an image of the current control contents and writes it to the specified stream.

For more info, see Windows.Web.UI.IWebViewControl

CaptureSelectedContentToDataPackageAsync()

Important

This method has been deprecated, and has a known issue. Avoid using this method in your production code.

Asynchronously gets a DataPackage that contains the selected content within the control.

For more info, see Windows.Web.UI.IWebViewControl

Close()

Closes the control.

GetDeferredPermissionRequestById(UInt32, WebViewControlDeferredPermissionRequest)

Returns the deferred permission request with the specified Id.

For more info, see Windows.Web.UI.IWebViewControl

GoBack()

Navigates the IWebViewControl to the previous page in the navigation history.

For more info, see Windows.Web.UI.IWebViewControl

GoForward()

Navigates the IWebViewControl to the next page in the navigation history.

For more info, see Windows.Web.UI.IWebViewControl

InvokeScriptAsync(String, IIterable<String>)

Executes the specified script function from the currently loaded HTML, with specific arguments, as an asynchronous action.

For more info, see Windows.Web.UI.IWebViewControl

MoveFocus(WebViewControlMoveFocusReason)

Move the focus.

Navigate(Uri)

Loads the HTML content at the specified Uniform Resource Identifier (URI).

For more info, see Windows.Web.UI.IWebViewControl

NavigateToLocalStreamUri(Uri, IUriToStreamResolver)

Loads local web content at the specified URI using an IUriToStreamResolver.

For more info, see Windows.Web.UI.IWebViewControl

NavigateToString(String)

Loads the specified HTML content as a new document.

For more info, see Windows.Web.UI.IWebViewControl

NavigateWithHttpRequestMessage(HttpRequestMessage)

Navigates the control to a URI with a POST request and HTTP headers.

For more info, see Windows.Web.UI.IWebViewControl

Refresh()

Reloads the current content in the control.

For more info, see Windows.Web.UI.IWebViewControl

Stop()

Halts the current control navigation or download.

For more info, see Windows.Web.UI.IWebViewControl

Events

AcceleratorKeyPressed

An event that is triggered when the accelerator key is pressed.

ContainsFullScreenElementChanged

An event that is triggered when the status of whether the control currently contains a full screen element or not changes.

For more info, see Windows.Web.UI.IWebViewControl

ContentLoading

An event that is triggered when the control has started loading new content.

For more info, see Windows.Web.UI.IWebViewControl

DOMContentLoaded

An event that is triggered when the control has finished parsing the current HTML content.

For more info, see Windows.Web.UI.IWebViewControl

FrameContentLoading

An event that is triggered when a frame in the control has finished parsing its current HTML content.

For more info, see Windows.Web.UI.IWebViewControl

FrameDOMContentLoaded

An event that is triggered when a frame in the control has finished parsing its current HTML content.

For more info, see Windows.Web.UI.IWebViewControl

FrameNavigationCompleted

An event that is triggered when a frame in the control has finished loading its content.

For more info, see Windows.Web.UI.IWebViewControl

FrameNavigationStarting

An event that is triggered before a frame in the control navigates to new content.

For more info, see Windows.Web.UI.IWebViewControl

GotFocus

Informs your app when the WebViewControl receives focus (due to the user clicking inside/outside the WebViewControl). Use in combination with the LostFocus event and programmatic focus changes using the WebViewControl.MoveFocus method.

LongRunningScriptDetected

An event that is triggered periodically while the control executes JavaScript, letting you halt the script.

For more info, see Windows.Web.UI.IWebViewControl

LostFocus

Informs your app when the WebViewControl loses focus. May be initiated by the user clicking inside/outside the WebViewControl or by a programmatic focus change, such as the app calling SetFocus on a window that is not the WebViewControl or a MoveFocus method call.

MoveFocusRequested

An event that is triggered when a focus move is requested.

NavigationCompleted

An event that is triggered when the control has finished loading the current content or if the navigation has failed.

For more info, see Windows.Web.UI.IWebViewControl

NavigationStarting

An event that is triggered before the control navigates to new content.

For more info, see Windows.Web.UI.IWebViewControl

NewWindowRequested

An event that is triggered when a user performs an action in the control that causes content to be opened in a new window.

For more info, see Windows.Web.UI.IWebViewControl

PermissionRequested

An event that is triggered when an action in the control requires that permission to be granted.

For more info, see Windows.Web.UI.IWebViewControl

ScriptNotify

An event that is triggered when the content contained in the control passes a string to the app using window.external.notify.

For more info, see Windows.Web.UI.IWebViewControl

UnsafeContentWarningDisplaying

An event that is triggered when the control shows a warning page for content that was reported as unsafe by SmartScreen Filter.

UnsupportedUriSchemeIdentified

An event that is triggered when an attempt is made to navigate to a URI using a scheme that the control doesn't support.

For more info, see Windows.Web.UI.IWebViewControl

UnviewableContentIdentified

An event that is triggered when the control attempts to download an unsupported file.

For more info, see Windows.Web.UI.IWebViewControl

WebResourceRequested

An event that is fired when an HTTP request is made.

For more info, see Windows.Web.UI.IWebViewControl

Applies to