public MushroomDetailPage(MushroomDetailViewModel model) : this() { BindingContext = model; var licenseWeb = new HtmlWebViewSource { Html = model.Mushroom.ImageLicense }; licenseWebView.Source = licenseWeb; licenseWebView.Navigating += (s, e) => { if (e.Url.StartsWith("http")) { try { var uri = new Uri(e.Url); Device.OpenUri(uri); } catch (Exception) { } e.Cancel = true; } }; }
async void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { var vm = new MushroomDetailViewModel(new MushroomDisplayModel(((HistoryItemDisplayModel)e.Item).Mushroom)); await Navigation.PushAsync(new MushroomDetailPage(vm)); }
//TODO: move this to VM using behaviours. https://anthonysimmon.com/eventtocommand-in-xamarin-forms-apps/ private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { var model = new MushroomDetailViewModel(((Prediction)e.Item).Mushroom); Navigation.PushAsync(new MushroomDetailPage(model)); }