WebView

Embeds live web content in the tree, backed by a UIKit web view.

Loads a Url or raw Html, reports navigation through Navigated and NavigationFailed, and runs JavaScript through EvaluateAsync.

Give it a bounded slot (a fill row, an explicit height), since web content has no intrinsic size to measure against.

public class WebView : Control

Properties

AllowsBackGestures

Whether swiping from the screen edge navigates back and forward through history.

Type: bool

public bool AllowsBackGestures { get; set; }

Html

Raw HTML to load, overriding Url when set.

Type: Bindable<string?>

public Bindable<string?> Html { get; set; }

Called with the final address each time a page finishes loading.

Type: Action<string>?

public Action<string>? Navigated { get; set; }

Called with the failure description when a load fails.

Type: Action<string>?

public Action<string>? NavigationFailed { get; set; }

Url

The web address to load. Takes effect when Html is not set.

Type: Bindable<string?>

public Bindable<string?> Url { get; set; }

Methods

EvaluateAsync

Runs JavaScript in the current page and returns its result as a string.

public Task<string?> EvaluateAsync(
  string javaScript)
ParameterSummary
string javaScriptThe script to evaluate.

Returns

  • Task<string?>: The result rendered as a string, or null when there is none.

GoBack

Navigates back to the previous page in history, if any.

public void GoBack()

GoForward

Navigates forward to the next page in history, if any.

public void GoForward()

MeasureOverride

Content measurement. Panels recurse; controls delegate to the native SizeThatFits.

protected override Size MeasureOverride(
  Size availableSize)
ParameterSummary
Size availableSizeThe size available for the view's content.

Returns

  • Size: The desired content size.

Reload

Reloads the current page.

public void Reload()