Overview
Webbrowser.NavigateMethod
Load the HTML content in the specified Uri.
The specified URI can be fully limited or become a relative Uri. When you set relative Uri, use the following conventions:
Effect
XAMLCode
< Grid X: Name = "Layoutroot" >
< Grid. Background >
< Lineargradientbrush Startpoint = "0, 0" Endpoint = "0, 1" >
< Gradientstop Color = "# Ff0055dd" Offset = "0" />
< Gradientstop Color = "# Ff00ddff" Offset = "1" />
</ Lineargradientbrush >
</ Grid. Background >
< Webbrowser X: Name = "Web"
Margin = "15" />
</ Grid >
CS code:
Public Mainpage ()
{
Initializecomponent ();
Loaded + = New Routedeventhandler (mainpage_loaded );
}
Void Mainpage_loaded ( Object Sender, routedeventargs E)
{
// Webbrowser. navigate Method
// Load the HTML content in the specified Uri.
// The specified URI can be fully limited or become a relative Uri. When you set relative Uri, use the following conventions:
// "/Page1.html" is an application-level resource that is parsed as the base URI of the application (xap file.
Web. navigate ( New Uri ( " Example-page.html " ,
Urikind. Relative )); // Relative URI
}
HTML page:
< Html Xmlns = "Http://www.w3.org/1999/xhtml" >
< Head ID = "Head1" Runat = "Server" >
< Title > Demo page </ Title >
</ Head >
< Body >
< Div Style = "Margin: 20px; font-family: Arial; font-size: 16pt" >
This is an out-of-browser application:
< P >
The Silverlight program is nested with HTML pages from the same domain. < A Href = "Example-page.html" > Silverlight </ A >
The HTML page in the program does not exist.
</ Div >
< Div Style = "Margin: 20px" >
< IMG SRC = "Ying.gif" />
</ Div >
</ Body >
</ Html >
Success !!!
Source code download
Author:Memories of lost youth
Source: http://www.cnblogs.com/lukun/
The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is displayed at an obvious location on the page. If you have any problems, you can useHttp://www.cnblogs.com/lukun/Thank you very much for contacting me.