[英]Windows Phone 8 App error “No XAML Was Found at the location…”
[英]windows phone 8 - xaml not found error
我的申请书有两页。 这两个页面都位于“查看文件夹”中( SplashScreen.xaml
和GetPhoneNumber.xaml
)。 我指定<DefaultTask Name ="_default" NavigationPage="View/SplashScreen.xaml"/>
运行此代码后,出现错误=> xaml未找到。 我在应用程序的根目录中创建了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>
我已经创建了与您相同的文件夹和文件结构。 您的文件名有问题。 我刚刚将“ Splashscreen.xaml”重命名为“ Abc.xaml”,还重命名了所有相关类。 那对我来说很好。 Windows Phone OS可能会保留“启动画面”字样。 目前,这是您的问题的解决方案。
您需要在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.