Export (0) Print
Expand All

WebBrowser.Source Property

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

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public Uri Source { get; set; }
<WebBrowser Source="uriString"/>

Property Value

Type: System.Uri
The URI source of the HTML content to display in the WebBrowser control.

The specified URI can be fully qualified or be a relative URI. When you set the Source property in XAML and use a relative URI you should use the following convention:

  • Source="/Page1.html" is an application level resource that gets resolved to the base URI of the application (XAP file). This means the relative URI must resolve to the same site of origin as the application.

You cannot specify a URL to an embedded or local resource.

The following example shows a WebBrowser with its Source property set to an HTML page.


<TextBlock Text="WebBrowser Control" />
<WebBrowser Source="http://localhost/HTMLPage1.html" Height="160" Width="160" x:Name="WB1"/>
<Button Width="200" x:Name="Button1" Content="Click for HTML content" Click="Button1_Click"   />


Silverlight

Supported in: 5, 4

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft