private void Initialize() { this.ItemSelected += (s, e) => { if (e.SelectedItem == null || ItemTappedCommand == null) { return; } ItemTappedCommand.Execute(e.SelectedItem); Device.StartTimer(TimeSpan.FromMilliseconds(50), () => { this.SelectedItem = null; return(false); }); }; this.ItemAppearing += (sender, e) => { if (LoadMoreCommand == null) { return; } LoadMoreCommand.Execute(e.Item); }; }
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { if (ItemTappedCommand != null && ItemTappedCommand.CanExecute(null)) { ItemTappedCommand.Execute(e.Item); } }
private void SetupChildren() { if (ItemSource is ICollection <AchievementTierProgressViewModel> tiers) { Content.Children.Clear(); foreach (var tier in tiers) { var container = new ContentView() { WidthRequest = ChildWidth, }; container.AddTouch((sender, args) => { ItemTappedCommand?.Execute(tier); }); if (ItemTemplate?.CreateContent() is View content) { content.BindingContext = tier; container.Content = content; } else { container.Content = new Label { Text = tier.ToString() }; } Content.Children.Add(container); } InvalidateLayout(); } }
void OnItemTapped(object sender, ItemTappedEventArgs e) { if (e.Item != null && ItemTappedCommand != null && ItemTappedCommand.CanExecute(e)) { ItemTappedCommand.Execute(e.Item); SelectedItem = null; } }
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { if (ItemTappedCommand != null && ItemTappedCommand.CanExecute(e.Item)) { ItemTappedCommand.Execute(e.Item); } ItemTapped?.Invoke(this, e.Item); Close_Tapped(this, null); }
private void OnItemTapped() { if (IsItemDisabled || ItemTappedCommand == null || !ItemTappedCommand.CanExecute(ItemTappedCommandParameter)) { return; } ItemTappedCommand.Execute(ItemTappedCommandParameter); }
public ListView() { ItemTapped += (sender, e) => { if (ItemTappedCommand?.CanExecute(e.Item) ?? false) { ItemTappedCommand?.Execute(e.Item); } SelectedItem = null; }; }
private void SfListViewEx_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) { if (e.ItemData != null) { if (e.ItemData.GetType() != typeof(GroupResult)) { if (this.ItemTappedCommand != null && this.ItemTappedCommand.CanExecute(e.ItemData)) { ItemTappedCommand.Execute(e.ItemData); } } } }
private void ExtendedListView_ItemTapped(object sender, ItemTappedEventArgs e) { try { var param = ItemTappedCommandParameter ?? e.Item; if (ItemTappedCommand != null && ItemTappedCommand.CanExecute(param)) { ItemTappedCommand.Execute(param); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void Initialize() { // ItemAppearing += InfiniteListView_ItemAppearing; //ItemTapped += ListView_ItemTapped; //quando invocar a propriedade ItemSelected this.ItemSelected += (sender, e) => { //Se não fizeram Binding faz nada if (ItemTappedCommand == null) { return; } //Se fizeram Binding chama o canExecute e passo o objeto que é o item selecionado da Lista if (ItemTappedCommand.CanExecute(e.SelectedItem)) { ItemTappedCommand.Execute(e.SelectedItem); } }; }
public void GrabBegin(TouchEventArgs args) { _scrollAmount = 10; _lastScrollDirectionUp = true; touchLocation = new Point(args.X, args.Y); draggingViews = null; isDragging = false; _maxDragDistance = 0.0; _draggedControl = null; foreach (var view in _absoluteLayout.Children) { var rect = AbsoluteLayout.GetLayoutBounds(view); if (rect.Contains(touchLocation)) { // if we have a draggable controls then we only accept a drag if our touch is on one of them otherwise fail var children = view.GetChildren <Draggable>(); if (children?.Count() > 0) { bool dragAccepted = false; foreach (var c in children) { var ptScreen = c.RelativeTo(Content); var r = new Rectangle(ptScreen.X, ptScreen.Y, c.Bounds.Width, c.Bounds.Height); if (r.Contains(touchLocation)) { _draggedControl = c; dragAccepted = true; break; } } if (!dragAccepted) { continue; } } draggingIsGroup = view.BindingContext is IReorderGroupItem; if (draggingIsGroup) { var canMove = ((IReorderGroupItem)view.BindingContext).CanMove; if (!canMove) { continue; } } // found one, register for pending drag operation draggingViews = new List <View>(); draggingViews.Add(view); var item = view.BindingContext; var idx = ItemsSource.IndexOf(item); originRect = rect; if (draggingIsGroup) { // if we're on a group header row, // add all views that belong to the same group to the selection for (int i = idx + 1; i < ItemsSource.Count && !(ItemsSource[i] is IReorderGroupItem); i++) { var childitem = ItemsSource[i]; var childview = _absoluteLayout.Children.Single(v => v.BindingContext == childitem); rect = AbsoluteLayout.GetLayoutBounds(childview); draggingViews.Add(childview); originRect.Bottom = rect.Bottom; originRect.Right = rect.Right; } } // notify vm of item tapped if (ItemTappedCommand != null) { ItemTappedCommand.Execute(item); } // highlite the item if supported if (item is IReorderActiveItem activeItem) { activeItem.IsActive = true; } } } }