[英]change default sound of toast notification for windows phone 8.1 app development
[英]Change default startup page for windows phone 8.1 app
我在通用应用程序解决方案的Windows Phone 8.1项目中创建了一个名为PivotPage.xaml的新基本页面。 当我在共享分区下转到App.xaml时 , 我想将下面代码中的HubPage更改为新创建的PivotPage 。 但是VS拒绝将PivotPage
识别为合法类型。 两个页面的命名空间和类定义完全相同。
if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
{
throw new Exception("Failed to create initial page");
}
如果还有其他方法可以更改默认页面,请告诉我。
试试这个
WP 8.1通用项目
- >添加新项 - >空白页
- >将其命名为MyPivotPage.xaml
MyPivotPage.xaml
<Page
x:Class="YOUR_NAMESPACE.MyPivotPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YOUR_NAMESPACE"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<PivotItem Header="item1">
<Grid/>
</PivotItem>
<!--Pivot item two-->
<PivotItem Header="item2">
<Grid/>
</PivotItem>
</Pivot>
</Grid>
</Page>
将“YOUR_NAMESPACE”更改为您的命名空间:)
然后在App.xaml.cs中
#if WINDOWS_PHONE_APP
if (!rootFrame.Navigate(typeof(MyPivotPage), e.Arguments))
{
throw new Exception("Failed to create initial page");
}
#endif
#if WINDOWS_APP
if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
{
throw new Exception("Failed to create initial page");
}
#endif
清洁你的解决方案
将WP 8.1 Universal设置为默认启动项目
部署到您的设备
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.