NavigationService.navigate NullReferenceException

时间:2019-03-21 10:14:11

标签: c# xaml visual-studio-2017 nullreferenceexception template10

我有一个简单的xaml页面,该页面调用navigation.navigate导航到另一个xaml页面,但是它会引发nullReferenceException。 here is where the program stops 我还实现了onNavigatedToAsync方法: onNavigationToAsync

我们尝试浏览的xaml页面:

<Page
x:Class="MovieFinder.Views.ResultPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:controls="using:Template10.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:MovieFinder.Views"   
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:MovieFinder.ViewModels"
mc:Ignorable="d">

<Page.DataContext>
    <vm:ResultPageViewModel/>
</Page.DataContext>


<Page.Resources>
    <CollectionViewSource x:Key="MovieViewSource"
                          IsSourceGrouped="True"
                          Source="{Binding ResultMovieList}"/>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <GridView Grid.Row="1"
              Padding="18">
        <GridView.ItemTemplate>
            <DataTemplate>
                <Grid Width="250" Height="250">
                    <Image Stretch="UniformToFill" VerticalAlignment="Center" />
                    <Border VerticalAlignment="Bottom" Background="#AA000000">
                        <TextBlock Margin="12" Foreground="White" Text="{Binding Title}"/>
                    </Border>
                </Grid>
            </DataTemplate>
        </GridView.ItemTemplate>
    </GridView>

</Grid>

0 个答案:

没有答案