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