1.跳转
NavigationService.Navigate(new Uri("/DetailPage.xaml", UriKind.Relative));
2.返回 NavigationService.GoBack();
3.传值
接收时在protected override void OnNavigatedTo 方法里接收
有三种传值方法
(1).NavigationService.Navigate(new Uri("/DetailPage.xaml?name=111", UriKind.Relative));
参数用字符串格式化来处理 String.Format("/Page2.xaml?name={0}", name.Text)
接收时:
(2). 在App里定义一个变量,如 num,
App app = Application.Current as App;
app.num = "上海睿智信息信息科技有限公司";
(3). 传递 PhoneApplicationService.Current.State["name"] = name.Text;
接收:name.Text = PhoneApplicationService.Current.State["name"] as string;
4.定义applicationBar
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar Mode="Minimized" IsVisible="True" IsMenuEnabled="True" Opacity="1">
<shell:ApplicationBarIconButton IconUri="/Assets/Images/appbar.delete.rest.png"
Text="删除"
Click="ApplicationBarIconButton_Click"/>
<shell:ApplicationBarIconButton IconUri="/Assets/Images/appbar.download.rest.png"
Text="下载"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="设置" Click="ApplicationBarMenuItem_Click"/>
<shell:ApplicationBarMenuItem Text="关于"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
5.横竖屏切换
phone:PhoneApplicationPage里添加:
SupportedOrientations="PortraitOrLandscape"
Orientation="Portrait"
OrientationChanged="MainPage_OrientationChanged_1"
程序里: private void MainPage_OrientationChanged_1(object sender,OrientationChangedEventArgs e)
{
if ((e.Orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
{
//竖屏处理
}
else
{
//横屏处理
}
}
http://bbs.windever.com/thread-3347-1-1.html