Xamarin.Forms Guides | Samples

Xamarin.Forms.WebView Class

A View that presents HTML content.

See Also: WebView


public class WebView : View, IElementConfiguration<WebView>


The following example shows a basic use.

C# Example

using System;
using Xamarin.Forms;

namespace FormsGallery
    class WebViewDemoPage : ContentPage
        public WebViewDemoPage()
            Label header = new Label
                Text = "WebView",
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center

            WebView webView = new WebView
                Source = new UrlWebViewSource
                    Url = "http://blog.xamarin.com/",
                VerticalOptions = LayoutOptions.FillAndExpand

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
                Children =


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,

The members of Xamarin.Forms.WebView are listed below.

See Also: View

Public Constructors

Creates a new WebView element with default values.

Public Fields

static readonly
CanGoBackPropertyBindableProperty. Backing store for the WebView.CanGoBack property.
static readonly
CanGoForwardPropertyBindableProperty. Backing store for the WebView.CanGoForward property.
static readonly
SourcePropertyBindableProperty. Backing store for the WebView.Source property.

Public Properties

CanGoBackBoolean. Gets a value that indicates whether the user can navigate to previous pages.
CanGoForwardBoolean. Gets a value that indicates whether the user can navigate forward.
SourceWebViewSource. Gets or sets the WebViewSource object that represents the location that this WebView object displays.

Public Methods

Evaluates the script that is specified by script.
Navigates to the previous page.
Navigates to the next page in the list of visited pages.
On<T>() : IPlatformElementConfiguration<T, WebView>
Returns the platform-specific instance of this WebView, on which a platform-specific method may be called.

Protected Methods

Method that is called when the binding context is changed.
Method that is called when WebView.Source is changed.
OnSourceChanged(Object, EventArgs)
Method that is called when the view source that is specified by the sender parameter is changed.

Public Events

NavigatedEvent that is raised after navigation completes.
NavigatingEvent that is raised when navigation starts.