コード例 #1
0
        protected override void OnAttached()
        {
            // Get the iOS UIView corresponding to the Element that the effect is attached to
            view = Control == null ? Container : Control;

            // Get access to the TouchEffect class in the .NET Standard library
            SkiaSharp_Samples.Xaml.TouchEffect effect = (SkiaSharp_Samples.Xaml.TouchEffect)Element.Effects.FirstOrDefault(e => e is SkiaSharp_Samples.Xaml.TouchEffect);

            if (effect != null && view != null)
            {
                // Create a TouchRecognizer for this UIView
                touchRecognizer = new TouchRecognizer(Element, view, effect);
                view.AddGestureRecognizer(touchRecognizer);
            }
        }
コード例 #2
0
        protected override void OnAttached()
        {
            // Get the Windows FrameworkElement corresponding to the Element that the effect is attached to
            frameworkElement = Control == null ? Container : Control;

            // Get access to the TouchEffect class in the .NET Standard library
            effect = (SkiaSharp_Samples.Xaml.TouchEffect)Element.Effects.
                     FirstOrDefault(e => e is SkiaSharp_Samples.Xaml.TouchEffect);

            if (effect != null && frameworkElement != null)
            {
                // Save the method to call on touch events
                onTouchAction = effect.OnTouchAction;

                // Set event handlers on FrameworkElement
                frameworkElement.PointerEntered  += OnPointerEntered;
                frameworkElement.PointerPressed  += OnPointerPressed;
                frameworkElement.PointerMoved    += OnPointerMoved;
                frameworkElement.PointerReleased += OnPointerReleased;
                frameworkElement.PointerExited   += OnPointerExited;
                frameworkElement.PointerCanceled += OnPointerCancelled;
            }
        }