我的申请表中有两页。这两个页面都在查看文件夹中(SplashScreen.xaml
和GetPhoneNumber.xaml
)。我指定<DefaultTask Name ="_default" NavigationPage="View/SplashScreen.xaml"/>
运行此代码后,我收到错误=&gt;找不到xaml。我在应用程序的Root中创建2个xaml文件并重复此方案并且问题不存在
public partial class SplashScreen : PhoneApplicationPage
{
System.Windows.Threading.DispatcherTimer _splashTimer;
public SplashScreen()
{
InitializeComponent();
_splashTimer = new System.Windows.Threading.DispatcherTimer();
Loaded += new RoutedEventHandler(Page_Loaded);
}
void Page_Loaded(object sender, RoutedEventArgs e)
{
if (_splashTimer != null)
{
_splashTimer.Interval = new TimeSpan(0, 0, 5);
_splashTimer.Tick += new EventHandler(_splashTimer_Tick);
_splashTimer.Start();
}
}
void _splashTimer_Tick(object sender, EventArgs e)
{
_splashTimer.Stop();
_splashTimer.Tick -= new EventHandler(_splashTimer_Tick);
_splashTimer = null;
NavigationService.Navigate(new Uri("/GetPhoneNumber.xaml", UriKind.Relative));
}
}
<phone:PhoneApplicationPage
x:Class="Ghavamin.View.SplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="{StaticResource GrayBrush}">
<Image Height="169" Margin="41,255,57,344" Width="382" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Image/splash.jpg"/>
</Grid>
</phone:PhoneApplicationPage>
答案 0 :(得分:0)
我创建了和你一样的文件夹和文件结构。您的文件名存在问题。我刚刚将“Splashscreen.xaml”重命名为“Abc.xaml”,并重命名所有相关的类。然后它对我来说很好。 Windows Phone OS可能会以某种方式保留“Splashscreen”字样。目前,这是您的问题的解决方案。
答案 1 :(得分:0)
您需要指定xaml中的确切路径。它被指定为Ghavamin.View.SplashScreen
,这意味着SplashSceen.xaml
文件夹中存在View
。因此,如下所示更改xaml或在调用Navigate()方法时包含确切的路径。
<phone:PhoneApplicationPage
x:Class="Ghavamin.SplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="{StaticResource GrayBrush}">
<Image Height="169" Margin="41,255,57,344" Width="382" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Image/splash.jpg"/>
</Grid>
</phone:PhoneApplicationPage>