Silverlight for Windows Phone 7

目标:

-页面

-Application Bar

-系统资源

-IsolatedStorage

-Splashscreen and Application Title

-ScreenShot

一.页面

页面是Silverlight的基础,是Windows Phone7应用程序的基本组成部分。

 

-PhoneApplicationFrame:是Frame的基类

-一个程序中只能有一个Frame;

-是所有页面的容器;

-为SystemTray和ApplicationBar(在Page里显示的)预留空间;

-PhoneApplicationPage:是Page的基类

-显示各自页面的ApplicationBar;

-放置页面内容的容器。

 

方向:

-Orientation = "Portrait"默认竖向

-this.Orientation = PageOrientation.Portrait;

转向:

-SupportedOrientations = "Portrait"

-this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;

-this.OrientationChanged+=new EventHandler<OrientationChangedEventArgs>(MainPage_OrientationChanged);

跳转:

-this.NavigationService.Navigate(new Uri("/Page1.xaml",UriKind.Relative));

-this.NavigationService.GoBack();//跳回

-this.NavigationService.GoForward();//跳前进

传值:

-this.NavigationService.Navigate(new Uri("/Page1.xaml?name=aa",UriKind.Relative));

-this.NavigationContext.QueryString["name"];//可以在Loaded方法中取值

 

二.ApplicationBar//Windows Phone 7特有的,其实是是菜单栏

ApplicationBarIconButton

-<shell:ApplicationBarIconButton IconUri="/Assets/appbar.add.rest.png" Text="增加" Click="ApplicationBarIconButton_Click"/>

-图标:48*48像素png图,前景色一般为白色。

Icon素材地址:

http://www.microsoft.com/downloads/details.aspx?familyid=369b20f7-9d30-4cff-8a1b-f80901b2da93&displaylang=en

C:\program files\Microsoft SDKs\Windows Phone\V7.0\Icons

http://www.daisy123.com/?page_id=427

MenuItems

-<shell:ApplicationBarMenuItem Text="" Click="ApplicationBarMenuItem_Click"/>

-无二级菜单

注意:

-ApplicationBarIconButton最多只能加4个

-Icon图片属性Property:

    Build Action:Content;

    Copy to Output Directory:Copy if newer(如果是新的就进行拷贝)、Copy Always;

 

三.系统资源:

由系统预定义好的资源,可以使用我们的页面的UI保持一致性;也可以使应用调用系统的字体颜色。

保存:C:\Program Files\Microsoft SDKs\WindowsPPhone\v7.0\Design\ThemeResources.xaml

使用:

-在XAML中使用{StaticResource }

-Application.Current.Resources["PhoneAccentColor"];

 

四.IsolatedStorage//程序被安装好以后开辟的区域

-silverlight的特色文件系统;

-只有本程序可以访问该区域,安全性高;

-默认大小为2GB;

-不能够保存很大的数据;

-不能长期保存数据;

-System.IO.IsolatedStorage(命名空间)

IsolatedStorageFile类:对文件系统来操作,如检查文件在不在等

IsolateStorygeFileStream类:操作文件内容,可以读取文件内容和写内容

 

五.SplashScreen and Application Tile

 

SplashScreen要求:文件名为SplashScreenImage.jpg,大小为480*800,否则无法加载。

Application Icon要求:ApplicationIcon.png Background.png

六.SnapShot

C:\windows\System32\SnippingTool.exe

原文地址:https://www.cnblogs.com/AngelLee2009/p/2211142.html