大佬教程收集整理的这篇文章主要介绍了wp7开发之创建第一个Silverlight应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
首先创建一个新的项目:
打开开发工具File/new Project:
如图所示,修改自己为项目定义的名字。
点击OK 就进入到了如下界面:
双击 page name 字体 在右下角Properties中修改Text 的内容为my browser。
然后在最左边ToolBox,拖拽一个button 和TextBox 到视图界面 ,然后分别修改button的内容为go 和TextBox 的内容为http://blog.csdn.net/wangkuifeng0118,最后在拖拽一个WebBrowser控件到视图中:
会出现如上图所示的界面效果,其中右边的MainPage.xaml中新增加了如下代码:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,12,0"> <Button Content="go" Height="72" HorizontalAlignment="Left" Margin="345,45,0" Name="button1" VerticalAlignment="Top" Width="111" Click="button1_Click" /> <TextBox Height="72" HorizontalAlignment="Left" Margin="0,0" Name="textBox1" Text="http//www.xBox.com" VerticalAlignment="Top" Width="356" TextChanged="textBox1_TextChanged" /> <phone:WebBrowser HorizontalAlignment="Stretch" Margin="0,84,0" Name="webBrowser1" VerticalAlignment="Stretch" Height="Auto" Width="Auto" /> </Grid>
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; namespace myFirstPhone { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); } private void button1_Click(object sender,RoutedEventArgs E) { } } }编写如下代码:
private void button1_Click(object sender,RoutedEventArgs E) { //得到TextBox控件中的值 String site = textBox1.Text; //启动webBrowser webBrowser1.Navigate(new Uri(site,UriKind.AbsolutE)); }代码已经编写完成,下面看一下运行和调试:
出现上图界面,然后点击go按钮 :
以上是大佬教程为你收集整理的wp7开发之创建第一个Silverlight应用程序全部内容,希望文章能够帮你解决wp7开发之创建第一个Silverlight应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。