Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 8 Windows Phone 8.1 NavigationService.navigate不工作_Windows Phone 8_Navigationservice - Fatal编程技术网

Windows phone 8 Windows Phone 8.1 NavigationService.navigate不工作

Windows phone 8 Windows Phone 8.1 NavigationService.navigate不工作,windows-phone-8,navigationservice,Windows Phone 8,Navigationservice,我对导航服务有问题。当我单击按钮时,我的应用程序总是结束,而不必重定向到另一个页面。我在我的项目中多次使用NavigationService,它运行良好,只是在这种情况下不起作用 这是我的XAML: <phone:PhoneApplicationPage x:Class="FaceDetectionEx.FaceDetection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http

我对导航服务有问题。当我单击按钮时,我的应用程序总是结束,而不必重定向到另一个页面。我在我的项目中多次使用NavigationService,它运行良好,只是在这种情况下不起作用

这是我的XAML:

<phone:PhoneApplicationPage
x:Class="FaceDetectionEx.FaceDetection"
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="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
xmlns:CamControl="clr-namespace:FaceDetectionEx"
shell:SystemTray.IsVisible="False">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Margin="0,10,0,21"  MouseLeftButtonDown="cameraViewer_MouseLeftButtonDown_1" MouseLeftButtonUp="cameraViewer_MouseLeftButtonUp_1">

        <CamControl:CameraViewer x:Name="cameraViewer">


        </CamControl:CameraViewer>

        <Canvas x:Name="cnvsFaceRegions" Width="480" Height="800" HorizontalAlignment="Center" VerticalAlignment="Center">

        </Canvas>

        <StackPanel x:Name="sck_Mask" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12,0,12,0" Width="600">
            <TextBlock x:Name="cameraResolution" Visibility="Collapsed" TextWrapping="Wrap" Text="" FontSize="30"></TextBlock>
        </StackPanel>

    </Grid>
    <Grid>
        <Button Content="Back to Menu"  Background="Black" HorizontalAlignment="Left" Margin="279,718,0,0" VerticalAlignment="Top" Visibility="Visible" Click="Button_Click_1" Width="201"/>
    </Grid>
</Grid>

谢谢您的建议。

在Windows Phone 8.1中,页面导航方法是:

框架导航(类型(主页))

您的应用程序中是否有名为MyFaceDetection的程序集(项目引用),它是否有这样的组件?尝试调试的一种方法是手动尝试并在代码中创建
MainPage
类(
var p=new MyFaceDetection.MainPage();
),然后查看它是否提供了更多信息。
private void Button_Click_1(object sender, RoutedEventArgs e)
    {                     
        NavigationService.Navigate(new Uri("/MyFaceDetection;component/MainPage.xaml", UriKind.RelativeOrAbsolute));                  
    }