Exemple #1
0
        public MenuItem()
        {
            InitializeComponent();

            GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => PageHelper.Navigate(PageId)),
                NumberOfTapsRequired = 1
            });
        }
Exemple #2
0
        public MycoPagingView() : base()
        {
            IsClippedToBounds = true;

            var swipeGestureRecognizer = new MycoSwipeGestureRecognizer();

            swipeGestureRecognizer.SwipeLeft  += SwipeGestureRecognizer_SwipeLeft;
            swipeGestureRecognizer.SwipeRight += SwipeGestureRecognizer_SwipeRight;
            GestureRecognizers.Add(swipeGestureRecognizer);
        }
Exemple #3
0
 public DragAndDropSample2DragAndDroppableView()
 {
     InitializeComponent();
     PanGestureRecognizer = new PanGestureRecognizer
     {
         TouchPoints = 1
     };
     PanGestureRecognizer.PanUpdated += PanGestureRecognizer_PanUpdated;
     GestureRecognizers.Add(PanGestureRecognizer);
 }
        public ImageButtonControl()
        {
            InitializeComponent();

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, new Binding(nameof(Command), source: this));
            tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, new Binding(nameof(CommandParameter), source: this));
            GestureRecognizers.Add(tapGestureRecognizer);
        }
Exemple #5
0
        public CustomImage()
        {
            var gesture = new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1
            };

            gesture.Tapped += ImageOn_Clicked;
            GestureRecognizers.Add(gesture);
        }
Exemple #6
0
        public SvgImage()
        {
            PaintSurface += OnPaintSurface;
            WidthRequest  = _iconSize + _padding * 2;
            HeightRequest = _iconSize + _padding * 2;

#pragma warning disable CS0618 // Type or member is obsolete
            GestureRecognizers.Add(new TapGestureRecognizer((obj) => Clicked?.Invoke(this, new EventArgs())));
#pragma warning restore CS0618 // Type or member is obsolete
        }
 public CustomHyperlinkSpan()
 {
     TextDecorations = TextDecorations.Underline;
     TextColor       = Color.Blue;
     GestureRecognizers.Add(new TapGestureRecognizer
     {
         // Launcher.OpenAsync is provided by Xamarin.Essentials.
         Command = new Command(async() => await Launcher.OpenAsync(Url))
     });
 }
 public RadioButton()
 {
     _canvasView = new SKCanvasView();
     _canvasView.PaintSurface += OnCanvasViewOnPaintSurface;
     Content      = _canvasView;
     AnimateClick = true;
     _tap         = new TapGestureRecognizer();
     _tap.Tapped += TapOnTapped;
     GestureRecognizers.Add(_tap);
 }
Exemple #9
0
        /// <summary>
        /// Constructor that adds a gesture recognizer.
        /// </summary>
        public GameBoardSquare() : base()
        {
            HorizontalOptions = LayoutOptions.Center;
            VerticalOptions   = LayoutOptions.Center;

            GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => OnSquareClicked()),
            });
        }
        public HyperlinkLabel()
        {
            TextDecorations = TextDecorations.Underline;
            TextColor       = Color.Blue;

            GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(async() => await Browser.OpenAsync(Url, BrowserLaunchMode.SystemPreferred))
            });
        }
        public TreeView()
        {
            Init();

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => TreeView_Tap())
            });

            TreeViewItem.treeView = this;
        }
Exemple #12
0
    public ScaleAndRotateContainer()
    {
        var pinchGesture = new PinchGestureRecognizer();

        pinchGesture.PinchUpdated += OnPinchUpdated;
        var panGesture = new PanGestureRecognizer();

        panGesture.PanUpdated += PanGesture_PanUpdated;
        GestureRecognizers.Add(pinchGesture);
    }
Exemple #13
0
        public ImageCropView()
        {
            HorizontalOptions = LayoutOptions.Center;
            VerticalOptions   = LayoutOptions.Center;

            _crop = new CropTransformation();

            _image = new CustomCachedImage()
            {
                LoadingDelay      = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                InputTransparent  = true,
                Aspect            = Aspect.Fill,
                Transformations   = new List <ITransformation>()
                {
                    _crop
                },
            };

            _root = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                InputTransparent  = true,
                Children          =
                {
                    _image
                }
            };

            var pinchGesture = new PinchGestureRecognizer();

            pinchGesture.PinchUpdated += PinchGesture_PinchUpdated;;

            var panGesture = new PanGestureRecognizer();

            panGesture.PanUpdated += PanGesture_PanUpdated;

            GestureRecognizers.Clear();
            GestureRecognizers.Add(pinchGesture);
            GestureRecognizers.Add(panGesture);

            _pinchObservable = Observable.FromEventPattern <PinchGestureUpdatedEventArgs>(pinchGesture, "PinchUpdated")
                               .Select(v => v.EventArgs).Where(v => v.Status == GestureStatus.Running);

            _panObservable = Observable.FromEventPattern <PanUpdatedEventArgs>(panGesture, "PanUpdated")
                             .Select(v => v.EventArgs).Where(v => v.StatusType == GestureStatus.Running);

            HandlePreviewTransformations(null, PreviewTransformations);
            Content = _root;
            ResetCrop();

            SetDelay();
        }
Exemple #14
0
        public CheckBox()
        {
            var TapGesture = new TapGestureRecognizer();

            TapGesture.Tapped += TapGestureOnTapped;
            GestureRecognizers.Add(TapGesture);

            ContentGrid = new Grid
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            ContentGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(40)
            });
            ContentGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ContentGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });

            ImageContainer = new Image
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
            };
            ImageContainer.HeightRequest = 30;
            ImageContainer.WidthRequest  = 30;

            ContentGrid.Children.Add(ImageContainer);

            ContentContainer = new ContentView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            Grid.SetColumn(ContentContainer, 1);

            TextContainer = new Label
            {
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            ContentContainer.Content = TextContainer;

            ContentGrid.Children.Add(ContentContainer);

            base.Content = ContentGrid;

            this.ImageContainer.Source = "CheckBoxUnchecked";
            this.BackgroundColor       = Color.Transparent;
        }
Exemple #15
0
 public Checkbox()
 {
     InitializeCanvas();
     WidthRequest      = HeightRequest = DEFAULT_SIZE;
     HorizontalOptions = VerticalOptions = new LayoutOptions(LayoutAlignment.Center, false);
     Content           = _skiaView;
     GestureRecognizers.Add(new TapGestureRecognizer
     {
         Command = _toggleCommand
     });
 }
Exemple #16
0
        public ExtendedSwipeView()
        {
            CloseRequested += OnCloseRequested;
            SwipeEnded     += OnSwipeEnded;

            var tappedGestureRecognizer = new TapGestureRecognizer();

            tappedGestureRecognizer.Tapped += HandleTapped;

            GestureRecognizers.Add(tappedGestureRecognizer);
        }
        protected override void OnPropertyChanged(string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            if (propertyName == TappedCommandProperty.PropertyName || Clicked != null && !GestureRecognizers.Any())
            {
                var clickGesture = new TapGestureRecognizer();
                clickGesture.Tapped += ClickGesture_Tapped;
                GestureRecognizers.Add(clickGesture);
            }
        }
        public PanContainer()
        {
            /**
             * Set PanGestureRecognizer.TouchPoints to control
             * the number of touch points needed to pan.
             */
            var panGesture = new PanGestureRecognizer();

            panGesture.PanUpdated += OnPanUpdated;
            GestureRecognizers.Add(panGesture);
        }
 void DismissKeyboardOnTouchPropertyChanged(InfiniteListView bindable, bool oldValue, bool newValue)
 {
     if (newValue != default(bool))
     {
         GestureRecognizers.Add(_gestureDismiss);
     }
     else
     {
         GestureRecognizers.Remove(_gestureDismiss);
     }
 }
Exemple #20
0
        public TappableLabel()
        {
            var tappedGesture = new TapGestureRecognizer
            {
                Command = new Command(OnLabelTapped)
            };

            tappedGesture.Tapped += TappedGesture_Tapped;

            GestureRecognizers.Add(tappedGesture);
        }
Exemple #21
0
    public PanContainer()
    {
        Debug.WriteLine("OK");
        // Set PanGestureRecognizer.TouchPoints to control the
        // number of touch points needed to pan
        var panGesture = new PanGestureRecognizer();

        //panGesture.TouchPoints = 2;
        panGesture.PanUpdated += OnPanUpdated;
        GestureRecognizers.Add(panGesture);
    }
Exemple #22
0
 public CustomGrid()
 {
     Padding       = new Thickness(0);
     Margin        = new Thickness(0);
     RowSpacing    = 0;
     ColumnSpacing = 0;
     GestureRecognizers.Add(new TapGestureRecognizer
     {
         Command = TransitionCommand
     });
 }
Exemple #23
0
        public GestureLayout(EventHandler eventPinch)
        {
            // Set PanGestureRecognizer.TouchPoints to control the
            // number of touch points needed to pan
            var panGesture = new PanGestureRecognizer();

            panGesture.PanUpdated += OnPanUpdated;
            GestureRecognizers.Add(panGesture);

//			eventPinch += OnPinch;
        }
Exemple #24
0
        private void Initialize()
        {
            _toggleImage = new Image();

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = ToogleCommand
            });

            _toggleImage.Source = Checked ? CheckedImage : UnCheckedImage;
            Content             = _toggleImage;
        }
Exemple #25
0
        public PinchToZoomContainer()
        {
            var pinchGesture = new PinchGestureRecognizer();           //捏合
            var panGesture   = new PanGestureRecognizer();             //移动

            pinchGesture.PinchUpdated += OnPinchUpdated;
            panGesture.PanUpdated     += OnPanUpdated;

            GestureRecognizers.Add(pinchGesture);
            GestureRecognizers.Add(panGesture);
        }
 /// <summary>
 /// <inheritdoc/>
 /// </summary>
 public SlidableLayout()
 {
     Padding           = 0;
     Margin            = 0;
     HorizontalOptions = LayoutOptions.FillAndExpand;
     VerticalOptions   = LayoutOptions.FillAndExpand;
     Config            = new SliderConfig(int.MinValue, int.MaxValue);
     m_rec             = new PanGestureRecognizer();
     GestureRecognizers.Add(m_rec);
     m_rec.PanUpdated += Rec_PanUpdated;
 }
Exemple #27
0
        public SvgButton()
        {
            var gestureRecognizer = new TapGestureRecognizer();

            GestureRecognizers.Add(gestureRecognizer);
            Tapped = Observable.FromEventPattern(gestureRecognizer, nameof(gestureRecognizer.Tapped));

            this.Tapped.
            Where(_ => Command?.CanExecute(CommandParameter) == true).
            Subscribe(_ => Command?.Execute(CommandParameter));
        }
        private void DoubleTapRecognizer_Tapped(object sender, EventArgs e)
        {
            ResetImage();
            MessagingCenter.Send <CustomPanPinchToZoomContainer>(this, "Reset");


            if (panGestureRecognizer != null)
            {
                GestureRecognizers.Remove(panGestureRecognizer);
            }
        }
Exemple #29
0
        public BashkraEntry()
        {
            InitializeComponent();

            InnerEntry.Focused   += InnerEntryOnFocused;
            InnerEntry.Unfocused += InnerEntryOnFocused;

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => InnerEntry.Focus())
            });
        }
Exemple #30
0
 public void Dispose()
 {
     if (GestureRecognizers != null)
     {
         GestureRecognizers.Clear();
     }
     if (_toggleImage != null)
     {
         _toggleImage.Source = null;
     }
 }