protected override void OnAttached() { _view = Control ?? Container; if (Control is Android.Widget.ListView || Control is Android.Widget.ScrollView) { // Except ListView and ScrollView because of Raising Exception. Device.BeginInvokeOnMainThread(() => AddCommand.SetOn(Element, false)); return; } _isTapTargetSoundEffect = TapSoundEffectElementType.Any(x => x == Element.GetType()); if (_audioManager == null) { _audioManager = (AudioManager)_view.Context.GetSystemService(Context.AudioService); } _gestureDetector = new GestureDetector(_view.Context, new ViewGestureListener(this)); _gestureDetector.IsLongpressEnabled = true; _view.Clickable = true; _view.LongClickable = true; UpdateSyncCanExecute(); UpdateCommandParameter(); UpdateLongCommandParameter(); UpdateEnableSound(); _view.Touch += _view_Touch; UpdateEnableRipple(); }
protected override void OnAttached() { if (Control is UIWebView || Control is UIScrollView) { _isForceDetached = true; // Except WebView and ScrollView because of Raising Exception when OnDetached. Device.BeginInvokeOnMainThread(() => AddCommand.SetOn(Element, false)); return; } base.OnAttached(); _view = Control ?? Container; _tapGesture = new UITapGestureRecognizer((obj) => { if (_command == null) { return; } if (!_command.CanExecute(_commandParameter)) { return; } _command.Execute(_commandParameter ?? Element); }); _view.UserInteractionEnabled = true; _view.AddGestureRecognizer(_tapGesture); _isDisableEffectTarget = !ExceptDisableEffectTargetType.Any(x => x == Element.GetType()); UpdateSyncCanExecute(); UpdateCommandParameter(); UpdateLongCommandParameter(); }