Windows phone 8 如何更改起始页?
在开发我的WindowsPhone8应用程序时,我经常想直接进入我正在开发的页面。这并不总是主页。这篇文章谈到应用程序有一个OnLaunched事件处理程序。我想这已经不存在了(也许我只是没看到而已)。有没有更通用的方法来设置首先启动解决方案中的哪个页面?找到了答案。把它放在这里是为了拯救其他可能遇到这种情况的人。现在在舱单上。转到项目>属性>WMAppManifest.xml。在编辑器中,将应用程序UI>导航页面更改为所需页面。在App menifest中将起始页面更改为所需页面。您也可以在App.xaml中的Windows phone 8 如何更改起始页?,windows-phone-8,Windows Phone 8,在开发我的WindowsPhone8应用程序时,我经常想直接进入我正在开发的页面。这并不总是主页。这篇文章谈到应用程序有一个OnLaunched事件处理程序。我想这已经不存在了(也许我只是没看到而已)。有没有更通用的方法来设置首先启动解决方案中的哪个页面?找到了答案。把它放在这里是为了拯救其他可能遇到这种情况的人。现在在舱单上。转到项目>属性>WMAppManifest.xml。在编辑器中,将应用程序UI>导航页面更改为所需页面。在App menifest中将起始页面更改为所需页面。您也可以在A
应用程序启动事件中更改它
通过使用类似于:
App.RootFrame.Navigate(new Uri("/Startup.xaml",UriKind.Relative));
请记住,您必须将“Startup.xaml”更改为自己的xaml文件。在windows通用应用程序中:
共享->App.xaml.cs
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
/*...*/
if (rootFrame.Content == null)
{
/*...*/
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
/*...*/
}
对于用C#编写的Windows Phone应用程序,将主页更改为您自己的页面名称:
打开WMAppManifest.xml文件
在应用程序UI选项卡下,将导航页面的值从默认的MainPage.xaml更改为YourPageName.xaml(将YourPageName替换为要使用的xaml文件名)