I want to have onBackButton only on that page

Hello!
I want to have the app exit when I touch the backButton. To do this, I created a Panel that asks if I really want to quit the app when I touch the backButton.

However, if you touch the backButton to go to the page to terminate the app from another page, it runs from the page to the end to the panel asking to end.

I want the panel asking for exit to be run via the backbutton only on the page for termination. Help me!!

MainView

<App>
  <HomeScreen ux:Global="HomeScreen"/>
  <Router ux:Name="router"/>
  <JavaScript> ... </JavaScript> <!-- router func -->


  <Panel Width="100%" Height="100%">
      <Navigator DefaultPath="tpStartPage">
          <StartPage ux:Template="tpStartPage" router="router"/>
          <EndPage ux:Template="tpEndPage" router="router"/>
      </Navigator>
  </Panel>
</App>

StartPage

<Page ux:Class="StartPage">
    <Router ux:Dependency="router" /><!-- router func -->
    <JavaScript>...</JavaScript>

    <DockPanel>
        <Panel ux:Name="panels" Width="50" Height="50" Color="#aaaaaa" Alignment="Top"/>
        <Rectangle ux:Name="finishRect" Color="#0003" Opacity="2" Visibility="Collapsed" ZOffset="0.9"/>
        <FinishPanel ux:Name="chekc" finishRect="finishRect" ZOffset="1"/>

        <Panel ux:Name="test" Width="50" Height="50" Color="#ed9d9d" Alignment="Bottom" Clicked="{puchPages}"/>
    </DockPanel>
    <Panel Width="40" Height="40" Color="#662626" Margin="0,0,0,30" ux:Name="adad">
        <Clicked>
          <Set panels.Color="#9ccb6d"/>
          <Set chekc.Visibility="Visible"/>
          <Set finishRect.Visibility="Visible"/>
        </Clicked>
    </Panel>
    <OnBackButton>
        <Set panels.Color="#9ccb6d"/>
        <Set chekc.Visibility="Visible"/>
    </OnBackButton>
</Page>

EndPage

<Page ux:Class="EndPage">
    <Router ux:Dependency="router" />

    <JavaScript>...</JavaScript>

    <Panel>
      <Button Text="Back!" Alignment="Center" Clicked="{gobackPage}"/>
    </Panel>
</Page>

You could wrap the OnBackButton inside of a WhileActive on that page you want it on. Then it’ll only be executed when that page is active:

<WhileActive>
    <OnBackButton>
        <Set panels.Color="#9ccb6d"/>
        <Set chekc.Visibility="Visible"/>
    </OnBackButton>
</WhileActive>