protected override void OnAttached() { _itemholdingEffect = Element.Effects.OfType <ItemholdingEffect>().FirstOrDefault(); _nativeView = Container; _nativeView.PointerReleased += _nativeView_PointerReleased; }
/// <summary> /// Apply the handler /// </summary> protected override void OnAttached() { _longPressedEffect = Element.Effects.OfType <ItemholdingEffect>().FirstOrDefault(); //because an effect can be detached immediately after attached (happens in listview), only attach the handler one time if (!_attached) { Container.AddGestureRecognizer(_longPressRecognizer); _attached = true; } }
/// <summary> /// Invoke the command if there is one /// </summary> private void HandleLongClick() { if (Element == null || _longPressedEffect == null) { Debug.WriteLine("Null"); return; } if (_longPressRecognizer.State == UIGestureRecognizerState.Began) { _longPressedEffect.ControlLongPressed(Element); var command = ItemholdingEffect.GetCommand(Element); command?.Execute(ItemholdingEffect.GetCommandParameter(Element)); } }
protected override void OnAttached() { _itemholdingEffect = Element.Effects.OfType <ItemholdingEffect>().FirstOrDefault(); if (!_attached) { if (Control != null) { Control.LongClickable = true; Control.LongClick += Control_LongClick; Control.Click += Control_Click; } else { Container.LongClickable = true; Container.LongClick += Control_LongClick; Container.Click += Control_Click; } _attached = true; } }