Reputation: 6227
I've set up a NavigateToPageAction
to navigate to a new View on an AppBarButton click, but the second event trigger I've set up doesn't navigate to the specified View, "ViewSubjectGradePage"
The first trigger works when navigating to "AboutPage" which is identical, so not sure why it doesn't work the same for the second trigger.
I've debugged this by checking the naming of the TargetPage and the syntax which looks correct.
Can anyone spot where the mistake is that's preventing the page navigation for the ViewListAppBarButton
click?
<Page.BottomAppBar>
<CommandBar x:Name="appBar" IsSticky="True">
<CommandBar.PrimaryCommands>
<AppBarButton x:Name="ClearAppBarButton"
Command="{Binding Path=ClearGradesCommand}"
Icon="Delete"
IsCompact="False"
Label="Clear All" />
<AppBarButton x:Name="ViewListAppBarButton"
Icon="ViewAll"
IsCompact="False"
Label="View">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:NavigateToPageAction TargetPage="LC_Points.View.ViewSubjectGradePage" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton x:Name="AboutAppBarButton"
Icon="Help"
IsCompact="False"
Label="About">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:NavigateToPageAction TargetPage="LC_Points.View.AboutPage" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</AppBarButton>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Label="Share score!" />
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
This is the View folder in the project, showing the ViewSubjectGradeViewModel
view I wan't to navigate to on the app bar button click:
Upvotes: 1
Views: 369
Reputation: 6227
For anyone coming across the same issue, check the class name of the page being navigated to.
In my case I had renamed the page to, ViewSubjectGradePage
from the Solution Explorer, but this didn't update the name in the xaml of the page, which was still named:
x:Class="LC_Points.View.ViewSubjectGradesPage"
Upvotes: 1