Ejemplo n.º 1
0
        private void ExerciseDisplay_AddToCartClicked(object sender, EventArgs e)
        {
            // selected exercise
            ExerciseDisplay   element = sender as ExerciseDisplay;
            ExerciseViewModel item    = element.BindingContext as ExerciseViewModel;

            // add a shopping cart item
            ((MainViewModel)this.BindingContext).ShoppingCart.IncrementOrder(item);
        }
Ejemplo n.º 2
0
        private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            // the user has tapped on an element
            ExerciseDisplay element = sender as ExerciseDisplay;

            // set the binding context to the select cell
            FakeExerciseCell.BindingContext = element.BindingContext;
            FakeExerciseCell.ImageOffsetX   = element.ImageOffsetX;
            FakeExerciseCell.ImageOffsetY   = element.ImageOffsetY;
            FakeExerciseCell.Opacity        = 1;
            FakeExerciseCell.IsVisible      = true;

            // set the selected item
            ((MainViewModel)this.BindingContext).SelectedExercise = element.BindingContext as ExerciseViewModel;


            // set the layout to the same position
            var       yScroll = ScrollContainer.ScrollY;
            Rectangle rect    = new Rectangle(
                x: ScrollContainer.X + element.X,
                y: ScrollContainer.Y + element.Y - yScroll,
                width: element.Width,
                height: element.Height);

            AbsoluteLayout.SetLayoutBounds(FakeExerciseCell, rect);

            // hide the cell we clicked on
            element.Opacity = 0.01;
            await FakeExerciseCell.ExpandToFill(this.Bounds);

            element.Opacity = 1;

            // display the page popover
            PagePopover.Opacity   = 0;
            PagePopover.IsVisible = true;
            await PagePopover.Expand();
        }