public HomePage() { InitializeComponent(); BindingContext = vm = new HomePageViewModel(); chartView = (pieChart as XFPieChart); chartView.SliceClick += chartView_SliceClick; chartView.FontBrush = new SolidColorBrush(Theme.DefaultTextColor); searchBar.TextChanged += searchBar_TextChanged; CountryListView.ItemTapped += (sender, args) => { ((ListView)sender).SelectedItem = null; }; CountryListView.ItemSelected += (sender, args) => { if (args.SelectedItem == null) { return; } var selectedItem = vm.Countries.First(x => x.Name == (args.SelectedItem as CountryItem).Name); var countryInfoPage = new CountryInfoPage { BindingContext = new CountryInfoPageViewModel(selectedItem) }; Navigation.PushAsync(countryInfoPage, true); }; }
public HomePage() { InitializeComponent(); BindingContext = vm = new HomePageViewModel(); chartView = (pieChart as XFPieChart); chartView.SliceClick += chartView_SliceClick; searchBar.TextChanged += searchBar_TextChanged; CountryListView.ItemTapped += (sender, args) => { ((ListView) sender).SelectedItem = null; }; CountryListView.ItemSelected += (sender, args) => { if (args.SelectedItem == null) return; var selectedItem = vm.Countries.First(x => x.Name == (args.SelectedItem as Item).Name); var countryInfoPage = new CountryInfoPage {BindingContext = new CountryInfoPageViewModel(selectedItem)}; Navigation.PushAsync(countryInfoPage, true); }; }