public ExtendedListView() { this.ItemTapped += (sender, e) => { TappedCommand?.Execute(e.Item); }; }
private void OnItemTapped(object sender, ItemTappedEventArgs e) { if (TappedCommand != null) { TappedCommand?.Execute(e.Item); } SelectedItem = null; }
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); } }
private void Initialize() { TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (s, e) => { TappedCommand.Execute(this.CommandParameter ?? this); }; this.GestureRecognizers.Add(tapGestureRecognizer); }
void HandleTapped(object sender, EventArgs e) { if (!IsSwiped) { TappedCommand.Execute(TappedCommandProperty); } else { IsSwiped = false; } }
/// <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); }
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); } }
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; }
private void OnSubmenuItemSelected(MenuItemModel arg) { TappedCommand?.Execute(arg); }
private void ClickGesture_Tapped(object sender, EventArgs e) { Tapped?.Invoke(this, e); TappedCommand?.Execute(CommandParameter); }
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); }
public void ItemTapped() { TappedCommand.Execute(null); }
public virtual async Task OnImageTapped() { await AnimateImage(); TappedCommand?.Execute(TappedCommandParameter); }