你的分享就是我们的动力 ---﹥

WP7 WebBrowser浏览器实现教程

时间:2013-05-24 16:12来源:www.chengxuyuans.com 点击:

phone:WebBrowse 该控件就是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>

 

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

 并在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         }

 整体运行效果:

新浪:

以上便是WP7 WebBrowser浏览器教程相关的教程,希望对您有所帮助!

转载注明地址:http://www.chengxuyuans.com/Windows Phone/62173.html