GoBack dont Work

In my app I have DirectNavigation and when I go to page2 I cant go back with GoBack. I go to the same page from different pages and I need to go back to the page that I access.

For example, if I am currently in page 1 and access to page 3 the app have to “remember” from wich page i access in the first place. So if I go back I have to go back to page 1.

I have something like this but nothing happen when I trigger GoBack:

UX:

<Style>
<Page ux:Cascade="false">
    <Enter>
        <Move X="-1" RelativeTo="Size" Duration="0.3" />
    </Enter>
    <Exit>
        <Move X="1" RelativeTo="Size" Duration="0.3" />
    </Exit>
</Page>
</Style>

    <DirectNavigation ux:Name="_nav" Active="Page1"/>

    <Page Background="Red" ux:Name="Page1">
        <Image WidthUnit="Percent" Width="100" Height="100">
            <Clicked Handler="GoPage2" />
            <Rectangle>
                <SolidColor Color="#000" />
            </Rectangle>
        </Image>
    </Page>

       <Page ux:Name="Page2">
           <Image WidthUnit="Percent" Width="100" Height="100">
            <Clicked Handler="Back"/>
            <Rectangle>
                <SolidColor Color="#000" />
            </Rectangle>
        </Image>
    </Page>
</DockPanel>

IN UNO:

void GoPage2(object sender, ClickedArgs args)
{
    _nav.Goto(Page2);
}

void Back(object sender, ClickedArgs args)
{
    _nav.GoBack();
}

Also having problems with going back. I’m coding it with NavigateTo and BackButton:

<Panel>

    <DirectNavigation ux:Name="_nav" Active="_menuPage" />

    <Style>
        <Page ux:Name="_page" ux:Cascade="false" Opacity="0.0">            <!-- fade in -->
            <ActivatingAnimation>
                <Change Target="_page.Opacity" Value="1" Duration="0.5" Easing="CircularInOut" />
            </ActivatingAnimation>
            <!-- white background -->
            <Rectangle ux:Binding="Appearance">
                <SolidColor Color="#FFF"/>
            </Rectangle>
        </Page>
    </Style>

    <!-- log-in page -->
    <Page ux:Name="_logInPage">
        <StackPanel>
            <Text Content="LogIn"/>
            <BackButton/>
            <BackButton NavigationContext="_nav"/>
            <Button Text="Cheat back">
                <Tapped>
                    <NavigateTo Context="_nav" Target="_menuPage" />
                </Tapped>
            </Button>
        </StackPanel>
    </Page>


    <!-- menu page -->
    <Page ux:Name="_menuPage">
        <StackPanel Orientation="Vertical">
            <Text Content="Menu"/>
            <Button Text="Login">
                <Tapped>
                    <NavigateTo Context="_nav" Target="_logInPage" />
                </Tapped>
            </Button>
        </StackPanel>
    </Page>

</Panel>

The app opens at the “menu” page. Press the “login” button to get to the login-page, which contains 3 options to go back to the “menu” page…

The uppermost button is a BackButton without any NavigationContext set. This simply doesn’t work. (reading the code, my understanding is that it should search for my DirectNavigation and should indeed work) The middle button is a BackButton with NavigationContext set. This doesn’t appear. The bottom button is a normal button that simply navigates back to the “menu” page, and this works.

I think both the BackButtons should work, but they don’t…

Anyone can help us with GoBack? Please :slight_smile:

DirectNavigation does not have a history, thus going back/fore do not work. Only LinearNavigation and HierarchicalNavigation have a history at the moment.