Esempio n. 1
0
        private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            //carousel page of user created jobs

            var selectedItem = (MicroItem)((ListView)sender).SelectedItem;

            if (selectedItem == null)
            {
                return;;
            }

            ItemCarouselPage page = new ItemCarouselPage();

            foreach (int itemId in Model.UserItems.Select(i => i.Id))
            {
                page.Children.Add(new ItemDetailPage()
                {
                    ItemId        = itemId,
                    IsEditEnabled = true
                });
            }

            page.CurrentPage = page.Children.FirstOrDefault(p => ((ItemDetailPage)p).ItemId == selectedItem.Id);
            Navigation.PushAsync(page);
        }
Esempio n. 2
0
        public ItemsPage()
        {
            InitializeComponent();

            // item selected handler
            itemListView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) =>
            {
                //the method is called if we set the item to null as well!
                var selectedItem = (InfiniteItemElement)((ListView)sender).SelectedItem;
                if (selectedItem == null)
                {
                    return;
                }

                //carousel of detail pages
                ItemCarouselPage carouselPage = new ItemCarouselPage();
                foreach (var element in Model.Items)
                {
                    carouselPage.Children.Add(new ItemDetailPage()
                    {
                        ItemId          = element.Item.Id,
                        IsAcceptEnabled = true
                    });
                }

                //current page based on the selected item
                carouselPage.CurrentPage =
                    carouselPage.Children.FirstOrDefault(p => ((ItemDetailPage)p).ItemId == selectedItem.Item.Id);

                await Navigation.PushAsync(carouselPage);

                itemListView.SelectedItem = null;
            };

            // model initialization
            Initialize();
        }
        private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            //creates a carousel page with selected item the same as the selected item of the list view (by content).

            var selectedItem = (MicroItem)((ListView)sender).SelectedItem;

            if (selectedItem == null)
            {
                return;;
            }

            ItemCarouselPage page = new ItemCarouselPage();

            foreach (int itemId in Model.UserItems.Select(i => i.Id))
            {
                page.Children.Add(new ItemDetailPage()
                {
                    ItemId = itemId
                });
            }

            page.CurrentPage = page.Children.FirstOrDefault(p => ((ItemDetailPage)p).ItemId == selectedItem.Id);
            Navigation.PushAsync(page);
        }