Ejemplo n.º 1
0
 public ExtendedListView()
 {
     this.ItemTapped += (sender, e) =>
     {
         TappedCommand?.Execute(e.Item);
     };
 }
Ejemplo n.º 2
0
 private void OnItemTapped(object sender, ItemTappedEventArgs e)
 {
     if (TappedCommand != null)
     {
         TappedCommand?.Execute(e.Item);
     }
     SelectedItem = null;
 }
Ejemplo n.º 3
0
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     if (Item.HasSubMenu)
     {
         IsExpanded = !_isExpanded;
         return;
     }
     TappedCommand?.Execute(Item);
 }
        private void ClickGesture_Tapped(object sender, EventArgs e)
        {
            Clicked?.Invoke(this, e);

            if (TappedCommand != null && TappedCommand.CanExecute(CommandParameter))
            {
                TappedCommand?.Execute(CommandParameter);
            }
        }
Ejemplo n.º 5
0
        private void Initialize()
        {
            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                TappedCommand.Execute(this.CommandParameter ?? this);
            };

            this.GestureRecognizers.Add(tapGestureRecognizer);
        }
Ejemplo n.º 6
0
 void HandleTapped(object sender, EventArgs e)
 {
     if (!IsSwiped)
     {
         TappedCommand.Execute(TappedCommandProperty);
     }
     else
     {
         IsSwiped = false;
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Invokes the item selected event.
        /// </summary>
        /// <param name="sender">System.Object repersenting the source of the event.</param>
        /// <param name="item">The arguments for the event.</param>
        public void InvokeItemSelectedEvent(object sender, object item)
        {
            //If this is not already the selected item.
            if (SelectedItem != item)
            {
                //Set the selected item property.
                SelectedItem = item;
            }

            //Fire the command
            TappedCommand?.Execute(item);
        }
Ejemplo n.º 8
0
        public void OnTapped()
        {
            System.Diagnostics.Debug.WriteLine("{0} was tapped", Text);
            if (TappedCommand != null && TappedCommand.CanExecute(WorkoutId.ToString()))
            {
                TappedCommand.Execute(WorkoutId.ToString());
            }

            var handler = Tapped;

            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 9
0
        private async Task OnStackLayoutTapped()
        {
            if (_stackTapped)
            {
                return;
            }

            _stackTapped = true;
            if (AnimateInnerImageOnTap)
            {
                await AnimateInnerImageAsync();
            }
            else if (ShowTapEffect)
            {
                await this.MimicTapEffect(TapEffectColor, TapEffectDurationMiliseconds);
            }
            TappedCommand?.Execute(TappedCommandParameter);
            _stackTapped = false;
        }
Ejemplo n.º 10
0
 private void OnSubmenuItemSelected(MenuItemModel arg)
 {
     TappedCommand?.Execute(arg);
 }
Ejemplo n.º 11
0
 private void ClickGesture_Tapped(object sender, EventArgs e)
 {
     Tapped?.Invoke(this, e);
     TappedCommand?.Execute(CommandParameter);
 }
Ejemplo n.º 12
0
        protected virtual void SetItems()
        {
            _itemsRootLayout.Children.Clear();
            _itemsRootLayout.RowDefinitions.Clear();
            _itemsRootLayout.ColumnDefinitions.Clear();

            _itemsRootLayout.RowSpacing    = Spacing;
            _itemsRootLayout.ColumnSpacing = Spacing;

            _innerSelectedCommand = new Command <View>(async view =>
            {
                if (IsAnimation)
                {
                    double targetScale = view.Scale;
                    await view.ScaleTo(targetScale * 0.9, 100);
                    await view.ScaleTo(1, 100);
                }

                if (TappedCommand?.CanExecute(view.BindingContext) ?? false)
                {
                    TappedCommand?.Execute(view.BindingContext);
                }

                SelectedItem = view.BindingContext;
            });

            if (ItemsSource == null)
            {
                return;
            }

            Device.StartTimer(TimeSpan.Zero, () =>
            {
                int rowCount = Height == -1 ? 1 : (int)Height / (ItemsHeight + Spacing);
                int colCount = Width == -1 ? 1 : (int)Width / (ItemsWidth + Spacing);

                if (ListOrientation == ScrollOrientation.Both)
                {
                    for (int i = 0; i < rowCount; i++)
                    {
                        _itemsRootLayout.RowDefinitions.Add(new RowDefinition {
                            Height = GridLength.Star
                        });
                    }

                    for (int i = 0; i < colCount; i++)
                    {
                        _itemsRootLayout.ColumnDefinitions.Add(new ColumnDefinition {
                            Width = GridLength.Star
                        });
                    }
                }

                int startIndex = 0;

                foreach (var item in ItemsSource)
                {
                    if (ListOrientation == ScrollOrientation.Horizontal)
                    {
                        _itemsRootLayout.Children.Add(GetItemView(item), startIndex, 0);
                    }
                    else if (ListOrientation == ScrollOrientation.Vertical)
                    {
                        _itemsRootLayout.Children.Add(GetItemView(item), 0, startIndex);
                    }
                    else
                    {
                        _itemsRootLayout.Children.Add(GetItemView(item), startIndex % colCount, startIndex == 0 ? 0 : startIndex / colCount);
                    }
                    startIndex++;
                }

                SelectedItem = null;

                return(false);
            });
        }
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     TappedCommand?.Execute(TappedCommandParameter);
     TappedEvent?.Invoke(this, TappedCommandParameter);
 }
Ejemplo n.º 14
0
 public void ItemTapped()
 {
     TappedCommand.Execute(null);
 }
Ejemplo n.º 15
0
        public virtual async Task OnImageTapped()
        {
            await AnimateImage();

            TappedCommand?.Execute(TappedCommandParameter);
        }