private async Task ShowDetail (IMapModel selectedItem) { POIs p = Global.K_POIs.First (x => x.NameOfThePOI == selectedItem.Name); List<Categories_POIs> cp = Global.K_Categories_POIs.Where (x => x.IDPOI == p.IDPOI).ToList (); Categories c = Global.K_Categories.First (x => x.IDCategory == cp [0].IDCategory); //take the first category Int32 kkkk; if (Int32.TryParse (c.NameOfTheCategory.Substring (0, 2), out kkkk)) c.NameOfTheCategory = c.NameOfTheCategory.Substring (3).ToUpper (); else c.NameOfTheCategory = c.NameOfTheCategory.ToUpper (); PosDetail d = new PosDetail (p, c.NameOfTheCategory, c.IDCategory); await Navigation.PushAsync (d, true); Debug.WriteLine ("..."); }
public PosList (string _title, Int32 _idCategory, Int32 _idPOI, Boolean _poisAroundMe) { //if (Device.OS == TargetPlatform.iOS) // this.Title = _title; this.poisAroundMe = _poisAroundMe; this.title = _title; this.idCategory = _idCategory; this.idPOI = _idPOI; //list (start) myListView = new ListView (); myListView.ItemTemplate = new DataTemplate (typeof(PoiListCell)); myListView.RowHeight = 158; myListView.HasUnevenRows = false; myListView.SeparatorVisibility = SeparatorVisibility.None; myListView.ItemTapped += async delegate(object sender, ItemTappedEventArgs e) { myListView.SelectedItem = null; PosDetail d = new PosDetail (e.Item as POIs, this.title, this.idCategory); if (Device.OS == TargetPlatform.iOS) NavigationPage.SetHasBackButton (d, false); await Navigation.PushAsync (d, true); myListView.SelectedItem = null; }; /* myListView.ItemSelected += async delegate(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem == null) return; PosDetail d = new PosDetail (); d.BindingContext = e.SelectedItem; Navigation.PushAsync (d); }; */ Binding myBinding = new Binding (); this.myWrapper = new PoisWrapperItemsSourceListView (); this.myWrapper.CreateList (this.idCategory, this.idPOI); myBinding.Source = this.myWrapper; myBinding.Path = "myList"; myListView.SetBinding (ListView.ItemsSourceProperty, myBinding); //myListView.ItemsSource = new ObservableCollection<POIs> (this.myWrapper.myList); //this.myWrapper.myList; //list (end) Content = new StackLayout { Children = { myListView, //new Label { Text = "Hello ContentPage" }, //new imagoLabelRender { Text = "Hello ContentPage", FontName = "FuturaStd-Medium.ttf" }, //new xUtilityPCL.CustomLabel { Text = "Hello ContentPage", FontName = "FuturaStd-Medium.ttf" }//, FontSize = 11.5 }, } }; myListView.BackgroundColor = Color.White; //20150628 inizio if (Device.OS == TargetPlatform.Android) { if (Global.LocationUpdatePending) { Global.calculateDistance (); Global.LocationUpdatePending = false; } } //20150628 fine }