转自:
内容:
windows phone 浏览器主要用的控件是phone:WebBrowser,该控件就是windows phone中的IE,在grid控件嵌套的grid控件中添加如下代码:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
< TextBox Height = " Auto " HorizontalAlignment = " Stretch " Margin = " 0,0,120,0 " Name = " textBox1 " Text = " http://www.cnblogs.com " VerticalAlignment = " Top " /> < Button Content = " 搜索 " Height = " Auto " HorizontalAlignment = " Right " Name = " button1 " VerticalAlignment = " Top " Width = " Auto " Click = " button1_Click " /> < phone:WebBrowser HorizontalAlignment = " Stretch " Margin = " 0,84,0,0 " Name = " webBrowser1 " VerticalAlignment = " Stretch " Height = " Auto " Width = " Auto " /> </ Grid >
相关的效果会在显示呈现:
并在button事件中如下代码
private void button1_Click(object sender, RoutedEventArgs e)
{ string site; site = textBox1.Text; webBrowser1.Navigate( new Uri(site, UriKind.Absolute)); }
整体运行效果:
新浪:
作者:
出处:
新建的wp開發者群:42182428
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。