In my application there is a page with one check box.
What I want is that whenever user press back button button.
If check box is checked then un check it
If check box is not checked then perform its functionality, like going back.
Updated:
This line is in page constructor.
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
This is event.
void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
if (RechargeAccountPivot.SelectedIndex == 2 && ePayBorder.Visibility == Windows.UI.Xaml.Visibility.Visible)
{
ePayBorder.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
e.Handled = true;
}
}
this code is running on bac press, but after this code executes the application page go back too.
I think its worth telling you that I am using basic page, which has these lines of code by default.
private NavigationHelper navigationHelper;
public RechargeAccount()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
I think this variable is handling navigation some where but un able to identify.