private async void lstVIew_ItemSelected(object sender, SelectedItemChangedEventArgs e) { if (lstVIew.SelectedItem == null) { return; } var selected = (Contact)e.SelectedItem; lstVIew.SelectedItem = null; var page = new ContactDetailPage(selected); page.ButtonSave.Clicked += (s, f) => { var contact = new Contact() { FirstName = page.EntryFirst.Text, LastName = page.EntryLast.Text, PhoneNumber = page.EntryPhone.Text, Email = page.EntryEmail.Text, IsBlocked = page.SwitchBlocked.IsEnabled, }; Navigation.PopAsync(); }; await Navigation.PushAsync(page); }
private async void ToolbarItem_Clicked(object sender, EventArgs e) { var page = new ContactDetailPage(); page.ButtonSave.Clicked += (s, f) => { var contact = new Contact() { FirstName = page.EntryFirst.Text, LastName = page.EntryLast.Text, PhoneNumber = page.EntryPhone.Text, Email = page.EntryEmail.Text, IsBlocked = page.SwitchBlocked.IsEnabled, }; _contacts.Add(contact); Navigation.PopAsync(); }; await Navigation.PushAsync(page); }