public async void HandleRowTapped(object sender, ItemTappedEventArgs e) { IBUTableRowDataModel selected = e.Item as IBUTableRowDataModel; var answer = await DisplayAlert(selected.SelectedHop.HopName, "Would you like to delete this hop?", "Yes", "No"); if (answer == true) { MessagingCenter.Send <IBUCalculatorPageXAML, IBUTableRowDataModel>(this, "DeleteHopXAML", selected); } ; }
public IBUListView() { //Create list of grains ObservableCollection <IBUTableRowDataModel> hopsAdded = new ObservableCollection <IBUTableRowDataModel> (); //Set properties and source for table HorizontalOptions = LayoutOptions.FillAndExpand; ItemsSource = hopsAdded; //Create ItemTemplate for rows ItemTemplate = new DataTemplate(() => { return(new ViewCell { View = new IBUViewCell() }); }); MessagingCenter.Subscribe <IBUAddHopPage, Hops> (this, "AddHop", (sender, arg) => { var aa = (arg.AAHigh + arg.AALow) / 2; IBUTableRowDataModel added = new IBUTableRowDataModel { SelectedHop = arg as Hops, AA = aa.ToString(), ounces = "0", BoilTime = "0" }; hopsAdded.Add(added); }); MessagingCenter.Subscribe <IBUAddHopPageXAML, Hops> (this, "AddHopXAML", (sender, arg) => { var aa = (arg.AAHigh + arg.AALow) / 2; IBUTableRowDataModel added = new IBUTableRowDataModel { SelectedHop = arg as Hops, AA = aa.ToString(), ounces = "0", BoilTime = "0" }; hopsAdded.Add(added); }); MessagingCenter.Subscribe <IBUCalculatorPage, IBUTableRowDataModel> (this, "DeleteHop", (sender, arg) => { hopsAdded.Remove(arg); }); MessagingCenter.Subscribe <IBUCalculatorPageXAML, IBUTableRowDataModel> (this, "DeleteHopXAML", (sender, arg) => { hopsAdded.Remove(arg); }); }