private async void Delete_Click(object sender, RoutedEventArgs e) { //delete the current detail try { int id = int.Parse(EventId.Text); viewModelMain.DeleteContact(id); } catch { MessageDialog md = new MessageDialog("There is no data", "No data"); await md.ShowAsync(); EventId.Focus(FocusState.Programmatic); EventId.SelectAll(); return; } Frame.Navigate(typeof(AppointmentPage)); }