windows phone 浏览器 (1)

     windows phone 浏览器主要用的控件是phone:WebBrowser,该控件就是windows phone中的IE,在grid控件嵌套的grid控件中添加如下代码:

 1    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

2               < TextBox Height = " Auto "  HorizontalAlignment = " Stretch "  Margin = " 0,0,120,0 "  Name = " textBox1 "  Text = " http://www.cnblogs.com "  VerticalAlignment = " Top "   />
3               < Button Content = " 搜索 "  Height = " Auto "  HorizontalAlignment = " Right "   Name = " button1 "  VerticalAlignment = " Top "  Width = " Auto "  Click = " button1_Click "   />
4               < phone:WebBrowser HorizontalAlignment = " Stretch "  Margin = " 0,84,0,0 "  Name = " webBrowser1 "  VerticalAlignment = " Stretch "  Height = " Auto "  Width = " Auto "   />
5           </ Grid >

 

 

 

 

 相关的效果会在显示呈现:

windows phone 浏览器 (1) 

 并在button事件中如下代码

 1 private void button1_Click(object sender, RoutedEventArgs e)

2          {
3               string  site;
4              site  =  textBox1.Text;
5              webBrowser1.Navigate( new  Uri(site, UriKind.Absolute));
6              
7          }

 

 

 

 整体运行效果:

windows phone 浏览器 (1) 

新浪:

windows phone 浏览器 (1) 

 

 

你可能感兴趣的:(windows phone)