Search code examples
c#uwptemplate10

Template10 create on canvas back button


How to create on canvas back button for Template10?

I tried following the example but the back button is not showing. It followed the information here btw: https://github.com/Windows-XAML/Template10/wiki/Controls#navigation (overriding build in behavior section)

 

<Page x:Class="Controls.MainPage"
      xmlns:controls="using:Template10.Controls">
    <controls:PageHeader Frame="{x:Bind Frame}" 
        BackButtonVisibility="Visible"
        Text="Detail" />
</Page>

When I navigate to the second page the back button is not showing. I wonder if I missed something here. I just wanted to show the back button in the canvas instead on the upper left corner in the app title. Thank you


Solution

  • To show the back button in the canvas instead on the upper left corner in the app title, you should be to set Bootstrapper.ShowShellBackButton to false. When the shell-drawn back button is visible, the PageHeader's on-canvas back button will not be visible.

    If the back button in the canvas does not display, you should be able to check if the PageHeader bind to the context of the navigation stack. And if there is no page in the BackStack, the back button does not display.

    For more info, please refer the Navigation.