I've got this xaml:
<Button VerticalAlignment="Bottom"
Click="SaveAndGoBack"
IsEnabled="{Binding Frame.CanGoBack,
ElementName=pageRoot}"
Style="{StaticResource BackButtonStyle}" />
...but on "tapping" (clicking) the back button, while it does return to the previous page, SaveAndGoBack()
is not called - I have a breakpoint on the first line, and it is not reached.
The button is obviously enabled, because I am able to select it and "go back." So why would the event handler not be reached?
UPDATE
Changing clicked to tapped makes no difference. This is the XAML now:
<Button VerticalAlignment="Bottom"
Tapped="SaveAndGoBack"
IsEnabled="{Binding Frame.CanGoBack,
ElementName=pageRoot}"
Style="{StaticResource BackButtonStyle}" />
...and this is the method, with a breakpoint on the first line, which is never reached (but the Main Page is returned to):
private async void SaveAndGoBack(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs args)
{
SOs_Locations sos_locs = new SOs_Locations { GroupName = txtbxGroup.Text };
int locNum;
int.TryParse(txtbxLocationNum.Text, out locNum);
sos_locs.LocationTitle = txtbxTitle.Text;
sos_locs.CivicAddress = txtbxAddress.Text;
double lat;
double.TryParse(txtbxLatitude.Text, out lat);
sos_locs.Latitude = lat;
double lng;
double.TryParse(txtbxLongitude.Text, out lng);
sos_locs.Longitude = lng;
if (cmbxDisplayColor.SelectedValue != null)
sos_locs.LocationColor = cmbxDisplayColor.SelectedValue.ToString();
await SQLiteUtils.UpdateLocationAsync(sos_locs);
Frame.Navigate(typeof(MainPage));
}