Windows Phone 7 Tips (1)

学习Windows Phone 7也有一段时间了,也整理了一些不错的知识点,下面一个系列将会每篇博客分享10个Windows Phone 7 技巧,并且提供离线文档下载。
1. Windows Phone 7 应用程序不能运行在后台,不支持多任务【但我们可以使用墓碑机制Tombstoning】。
2. Windows Phone 7 应用程序的xap包最大运行为400MB。
3. 设置应用程序的ico图标:右击项目--设置icon为自己的图片即可。
4. 替换默认的windows phone 7 的启动画面:将SplashScreenImage替换为自己的图片即可。
5. 设置Windows Phone 7应用程序的启动页面:在WMAppManifest.xml中设置。
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
</Tasks>
6. Windows Phone 7 页面导航支持使用别名,使用方法如下:
在App.xaml中配置匹配别名,添加命名空间。
Windows Phone 7 Tips (1)
  配置匹配标签如下:  Windows Phone 7 Tips (1)
然后在其后置代码App.xaml.cs的App()方法中添加如下代码: Windows Phone 7 Tips (1)
然后我们就可以在XAML代码中使用别名来找到具体的页面了 。 Windows Phone 7 Tips (1)7. Windows Phone 7 最简单的页面传值 。
传递页: Windows Phone 7 Tips (1)
接受页 在Load事件中:
if (NavigationContext.QueryString.ContainsKey("username")) { tbUserName.Text = NavigationContext.QueryString["username"].ToString(); }
8. 禁用物理回退键 :重写页面的BackKeyPress事件:
private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; }
9. Windows Phone 7 中隐藏和显示系统托盘:
Microsoft.Phone.Shell.SystemTray.IsVisible = true;
10. Application Bar最多支持4个操作图标,Application Bar中不支持数据绑定,需要使用C#代码在后置代码中控制.并且推荐使用透明度数值为0,0.5和1。
为了方便大家离线阅读,制作CHM文件,文件下载:Windows Phone 7 Tips (1).chm (7kb)。 Windows Phone 7 Tips (1)
Tags: 

延伸阅读

最新评论

发表评论