当前位置:编程学习 > wap >>

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>
 
 
 
 
 相关的效果会在显示呈现:

\

并在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         }
 
 
 
 整体运行效果:

\


新浪:

\



摘自 shenzhoulong的专栏
补充:移动开发 , Windows Phone ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,