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

            if (TappedCommand != null && TappedCommand.CanExecute(CommandParameter))
            {
                TappedCommand?.Execute(CommandParameter);
            }
        }
Exemplo n.º 4
0
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     if (Item.HasSubMenu)
     {
         IsExpanded = !_isExpanded;
         return;
     }
     TappedCommand?.Execute(Item);
 }
Exemplo n.º 5
0
        private void Initialize()
        {
            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();

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

            this.GestureRecognizers.Add(tapGestureRecognizer);
        }
Exemplo n.º 6
0
 void HandleTapped(object sender, EventArgs e)
 {
     if (!IsSwiped)
     {
         TappedCommand.Execute(TappedCommandProperty);
     }
     else
     {
         IsSwiped = false;
     }
 }
Exemplo 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);
        }
Exemplo 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);
            }
        }
Exemplo 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;
        }
Exemplo n.º 10
0
        public virtual async Task OnImageTapped()
        {
            await AnimateImage();

            TappedCommand?.Execute(TappedCommandParameter);
        }
Exemplo n.º 11
0
 private void OnSubmenuItemSelected(MenuItemModel arg)
 {
     TappedCommand?.Execute(arg);
 }
Exemplo n.º 12
0
 public virtual void TappedHandler(TappedCommand command)
 {
     this.Tapped(command.Sender as AnimalViewModel);
 }
Exemplo n.º 13
0
 public void ItemTapped()
 {
     TappedCommand.Execute(null);
 }
Exemplo n.º 14
0
 public virtual void ExecuteTapped(TappedCommand command)
 {
     command.Sender = Animal;
     Animal.Tapped.OnNext(command);
 }
Exemplo n.º 15
0
 private void SendAnswer()
 {
     _moderator.Answer(_question, Answer);
     TappedCommand.ChangeCanExecute();
 }
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     TappedCommand?.Execute(TappedCommandParameter);
     TappedEvent?.Invoke(this, TappedCommandParameter);
 }
Exemplo n.º 17
0
 private void ClickGesture_Tapped(object sender, EventArgs e)
 {
     Tapped?.Invoke(this, e);
     TappedCommand?.Execute(CommandParameter);
 }
Exemplo n.º 18
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);
            });
        }