I made a basic app that has a menu with two options, each of them takes to a new page. The problem is that those pages are launched over the main one so it overlapses the menu and everything behind. Those pages don't have any content, their code is an simple xaml and xaml.cs.
I used some examples that Microsoft developer webpage gives, but the result is the same. I haven't found any other possible solution and I am not able to understand what is happening.
Page that contains the menu
<Grid>
<NavigationView
x:Name="NavView"
ItemInvoked="NavViewItemInvoked"
Windows10version1803:BackRequested="NavViewBackRequested"
Windows10version1803:IsBackEnabled="{x:Bind Frame.CanGoBack, Mode=OneWay}"
>
<NavigationView.MenuItems>
<NavigationViewItem x:Name="HomePage" Content="Home" Icon="Home" />
<NavigationViewItem x:Name="AddPage" Content="Add" Icon="Add" />
</NavigationView.MenuItems>
<NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="SearchBox" QueryIcon="Find" />
</NavigationView.AutoSuggestBox>
<ScrollViewer>
<frame x:Name="ContentFrame" Padding="12,0,12,24" IsTabStop="True" NavigationFailed="ContentFrame_NavigationFailed" />
</ScrollViewer>
</NavigationView>
<frame x:Name="frame" Margin="20,0,0,0" Navigating="OnNavigatingToPage">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition>
<NavigationThemeTransition.DefaultNavigationTransitionInfo>
<EntranceNavigationTransitionInfo />
</NavigationThemeTransition.DefaultNavigationTransitionInfo>
</NavigationThemeTransition>
</TransitionCollection>
</Frame.ContentTransitions>
</frame>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{x:Bind NavView.CompactModeThresholdWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!-- Leave the next line for left-only navigation. -->
<Setter Target="ContentFrame.Padding" Value="24,0,24,24" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
Function that opens the selected item in the menu:
private void NavViewItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
var label = args.InvokedItem as string;
var pageType =
label == "Home" ? typeof(HomePage) :
label == "Add" ? typeof(AddPage) : null;
if (pageType != null && pageType != AppFrame.CurrentSourcePageType)
{
AppFrame.Navigate(pageType);
}
}
I hope someone could tell me what it's happening or where is the mistake.
Thanks a lot