void TouchWindow_PreviewStylusMove(object sender, StylusEventArgs e)
        {
            lock (_moveLock)
            {
                if (!_touches.ContainsKey(e.StylusDevice.Id))
                {
                    var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(_element)[0]);
                    touchPointSize.Width  *= InputSizeScale;
                    touchPointSize.Height *= InputSizeScale;

                    var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(_element), TouchAction.Down);

                    _touches.Add(e.StylusDevice.Id, touchPoint);

                    GestureTouchDown(_element, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
                }
                else
                {
                    if (_touchInputCounter[e.StylusDevice.Id]++ <= InputFilter)
                    {
                        return;
                    }

                    _touchInputCounter[e.StylusDevice.Id] = 0;

                    var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(_element)[0]);
                    touchPointSize.Width  *= InputSizeScale;
                    touchPointSize.Height *= InputSizeScale;

                    var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(_element), TouchAction.Up);
                    GestureTouchMove(_element, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
                }
            }
        }
        void TouchWindow_PreviewStylusMove(object sender, StylusEventArgs e)
        {
            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);
            var touchPoint     = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Up);

            GestureTouchMove(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
        }
        void TouchWindow_PreviewStylusDown(object sender, StylusDownEventArgs e)
        {
            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);

            var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Down);

            _touches.AddOrUpdate(e.StylusDevice.Id, touchPoint,
                                 (key, oldValue) => touchPoint);

            GestureTouchDown(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
        }
        void TouchWindow_PreviewStylusUp(object sender, StylusEventArgs e)
        {
            if (!_touches.ContainsKey(e.StylusDevice.Id))
            {
                return;
            }

            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);

            var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Up);

            GestureTouchUp(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));

            GestureTouchPoint dump;

            _touches.TryRemove(e.StylusDevice.Id, out dump);
        }
        void TouchWindow_PreviewStylusDown(object sender, StylusDownEventArgs e)
        {
            if (_touchInputCounter.ContainsKey(e.StylusDevice.Id))
            {
                _touchInputCounter[e.StylusDevice.Id] = 0;
            }
            else
            {
                _touchInputCounter.Add(e.StylusDevice.Id, 0);
            }

            if (HasTouchSizeSupport)
            {
                return;
            }
            var size = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(_element)[0]);

            if (size.Height > 0 || size.Width > 0)
            {
                HasTouchSizeSupport = true;
            }
        }