As you can see from the name, this guy just opens the browser and browses the specified page.
It has two identical attributes: The URI attribute is of the system. Uri type, which is a newly written attribute;
The URL is of the string type, but if this attribute is used, a warning "expired" will be issued, so we recommend that you use the former.
In the following example, after clicking the button, the Web browser is opened and the address entered in the text box is located. However, the two attributes mentioned above are used respectively. After the program runs, you will find that the effect is the same.
<Phone: phoneapplicationpage <br/> X: class = "webtask. mainpage "<br/> xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation "<br/> xmlns: x =" http://schemas.microsoft.com/winfx/2006/xaml "<br/> xmlns: Phone =" CLR-namespace: Microsoft. phone. controls; Assembly = Microsoft. phone "<br/> xmlns: shell =" CLR-namespace: Microsoft. phone. shell; Assembly = Microsoft. phone "<br/> xmlns: D =" http://schemas.microsoft.co M/expression/blend/2008 "<br/> xmlns: MC =" http://schemas.openxmlformats.org/markup-compatibility/2006 "<br/> MC: ignorable =" D "D: designwidth =" 480 "D: designheight = "768" <br/> fontfamily = "{staticresource phonefontfamilynormal}" <br/> fontsize = "{staticresource quota}" <br/> foreground = "{staticresource phoneforegroundbrush} "<br/> supportedorientations =" portrait "orientation =" portrait "<br /> Shell: systemtray. isvisible = "true"> </P> <p> <! -- Layoutroot is the root mesh that contains all page content --> <br/> <grid X: Name = "layoutroot" background = "Transparent"> <br/> <grid. rowdefinitions> <br/> <rowdefinition Height = "Auto"/> <br/> <rowdefinition Height = "*"/> <br/> </grid. rowdefinitions> </P> <p> <! -- Titlepanel contains the application name and page title --> <br/> <stackpanel X: Name = "titlepanel" grid. row = "0" margin = ","> <br/> <textblock X: name = "applicationtitle" text = "my application" style = "{staticresource phonetextnormalstyle}"/> <br/> <textblock X: name = "pagetitle" text = "Start Web Browser" margin = "9, 0 "fontsize =" 50 "/> <br/> </stackpanel> </P> <p> <! -- Contentpanel-place other content here --> <br/> <grid X: Name = "contentpanel" grid. row = "1" margin = "12,0, 12,0"> <br/> <textblock Height = "40" horizontalalignment = "Left" margin = "38,57, 0, 0 "name =" textblock1 "text =" Enter the URL: "verticalalignment =" TOP "width =" 286 "fontsize =" 28 "/> <br/> <textbox Height =" 72 "horizontalalignment =" Left "margin =" 12,122, 394 "name =" txturl "verticalignment =" TOP "width =" "/> <br/> <button content =" set through URI object and start "Height =" 79" horizontalalignment = "Left" margin = "12,222, 394 "name =" button1 "verticalignment =" TOP "width =" "Click =" button#click "/> <br/> <button content =" set and start "height" Through strings = "79" horizontalalignment = "Left" margin = "9,323, 394 "name =" button2 "verticalignment =" TOP "width =" "Click =" button2_click "/> <br/> </GRID> </P> <p> </phone: phoneapplicationpage>
Using system; <br/> using system. collections. generic; <br/> using system. LINQ; <br/> using system. net; <br/> using system. windows; <br/> using system. windows. controls; <br/> using system. windows. documents; <br/> using system. windows. input; <br/> using system. windows. media; <br/> using system. windows. media. animation; <br/> using system. windows. shapes; <br/> using Microsoft. phone. controls; <br/> using Microsoft. phone. tasks; </P> <p> namespace webtask <br/>{< br/> Public partial class mainpage: phoneapplicationpage <br/>{< br/> // constructor <br/> Public mainpage () <br/>{< br/> initializecomponent (); <br/>}</P> <p> private void button#click (Object sender, routedeventargs E) <br/>{< br/> // set through URI object <br/> webbrowsertask Wt = new webbrowsertask (); <br/> wt. uri = new uri (txturl. text, urikind. absolute); <br/> wt. show (); <br/>}</P> <p> private void button2_click (Object sender, routedeventargs E) <br/>{< br/> // set by string <br/> webbrowsertask Wt = new webbrowsertask (); <br/> wt. url = txturl. text; <br/> wt. show (); <br/>}< br/>}