public SearchNavigationPage()
        {
            Title = "Search";
            Icon = "search.png";

            var productManager = new ProductManager();
            var products = productManager.GetAll();

            PushAsync(new SearchPage(products));
        }
Exemple #2
0
        public CartPage()
        {
            _productManager = new ProductManager();

            _cartViewModel = new CartViewModel();
            this.BindingContext = _cartViewModel;

            _qtyPicker = new Picker {IsVisible = false};
            for (var i = 1; i < 100; _qtyPicker.Items.Add((i++).ToString()))
            _qtyPicker.SelectedIndexChanged += OnQtyPickerSelectedIndexChanged;

            Title = "Cart";

            var listView = new ListView();
            listView.ItemTapped += OnListViewItemTapped;
            listView.ItemTemplate = new DataTemplate(typeof(CartCell));
            listView.RowHeight = 60;
            listView.SetBinding(ListView.ItemsSourceProperty, "CartList");

            var footer = new Label
            {
                HorizontalOptions = LayoutOptions.End
            };
            footer.SetBinding(Label.TextProperty, new Binding("TotalAmount", stringFormat: "Total Amount: ${0:0.00}", source: _cartViewModel));
            listView.Footer = new ContentView
            {
                Padding = new Thickness(10),
                Content = footer
            };

            ToolbarItems.Add(new ToolbarItem("Done", null, async () =>
            {
                await Navigation.PushAsync(new LoginPage());
            }));

            Content = new StackLayout
            {
                Children =
                {
                    _qtyPicker,
                    listView
                }
            };
        }