private void OnPreviewInput(object sender, MouseWheelInputEventArgs e)
        {
            Debug.Assert(Equals(sender, Element));
            var client = _clients.FirstOrDefault(c => c.IsActive);

            client?.OnPreviewInput(sender, e);
        }
        private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            // update wheel motion info
            var wheel     = e.MouseDevice.GetWheel();
            var timestamp = e.Timestamp < 0 ? 0 : e.Timestamp;
            var info      = wheel.PreTransmit(timestamp, e.Delta);

            // 1. Tunneling event
            // Clients and behaviors use this tunneling event to update the wheel transfer
            // case by dynamically creating / retrieving motion shafts.
            var originalSource = GetOriginalSource(e);
            var inputEventArgs = new MouseWheelInputEventArgs(this, wheel, e)
            {
                RoutedEvent = PreviewMouseWheelInputEvent
            };

            originalSource.RaiseEvent(inputEventArgs);

            // In cooperation with clients and behaviors, if inputEventArgs.Handled is set to true,
            // the controller lets the underlying mouse wheel tunneling event continue its route.
            if (inputEventArgs.Handled)
            {
                return;
            }

            // Fill motion reservoir
            wheel.Transmit(info, e.Delta, null);
            // 2. Bubbling event
            // Clients consume the motion here
            inputEventArgs.RoutedEvent = MouseWheelInputEvent;
            originalSource.RaiseEvent(inputEventArgs);
            // 3. Remaining motion is processed here
            inputEventArgs.EndCommand();
            e.Handled = true;
        }
        private void OnInput(object sender, MouseWheelInputEventArgs e)
        {
            Debug.Assert(Equals(sender, Element));
            e.Controller = this;
            var client = _clients.FirstOrDefault(c => c.IsActive);

            if (client != null)
            {
                _exitElement = client.ExitElement;
                client.OnInput(sender, e);
            }
        }
Esempio n. 4
0
        protected bool TransferMotion(MouseWheelInputEventArgs e)
        {
            var shaft = GetMotionShaft(e.Wheel);

            if (shaft.Transfer(MotionInput, e))
            {
                return(true); // client can still move - stop event propagation
            }
            if (NestedMotionEnabled)
            {
                return(false); // let the mouse wheel event propagate up the visual tree
            }
            // empty the shaft transfer staging area and stop event propagation
            return(shaft.Transfer(NativeMotionTarget.Terminal, e));
        }
Esempio n. 5
0
 public virtual void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotion(e);
 }
Esempio n. 6
0
 public virtual void OnPreviewInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = GetMotionShaft(e.Wheel) == null;
 }
Esempio n. 7
0
 public override void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotionNative(e);
 }
Esempio n. 8
0
 protected bool TransferMotionNative(MouseWheelInputEventArgs e)
 {
   return GetMotionShaft(e.Wheel).Transfer(this as INativeMotionTarget, e);
 }
 private void OnInput(object sender, MouseWheelInputEventArgs e)
 {
   Debug.Assert(sender == Element);
   e.Controller = this;
   var client = _clients.FirstOrDefault(c => c.IsActive);
   if (client != null)
   {
     _exitElement = client.ExitElement;
     client.OnInput(sender, e);
   }
 }
Esempio n. 10
0
 private void OnPreviewInput(object sender, MouseWheelInputEventArgs e)
 {
   Debug.Assert(sender == Element);
   var client = _clients.FirstOrDefault(c => c.IsActive);
   if (client != null)
     client.OnPreviewInput(sender, e);
 }
Esempio n. 11
0
    private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
    {
      // update wheel motion info
      var wheel = e.MouseDevice.GetWheel();
      var info = wheel.PreTransmit(e.Timestamp, e.Delta);

      // 1. Tunneling event
      // Clients and behaviors use this tunneling event to update the wheel transfer
      // case by dynamically creating / retrieving motion shafts.
      var originalSource = GetOriginalSource(e);
      var inputEventArgs = new MouseWheelInputEventArgs(this, wheel, e) { RoutedEvent = PreviewMouseWheelInputEvent };
      originalSource.RaiseEvent(inputEventArgs);

      // In cooperation with clients and behaviors, if inputEventArgs.Handled is set to true,
      // the controller lets the underlying mouse wheel tunneling event continue its route.
      if (inputEventArgs.Handled)
        return;

      // Fill motion reservoir
      wheel.Transmit(info, e.Delta, null);
      // 2. Bubbling event
      // Clients consume the motion here
      inputEventArgs.RoutedEvent = MouseWheelInputEvent;
      originalSource.RaiseEvent(inputEventArgs);
      // 3. Remaining motion is processed here
      inputEventArgs.EndCommand();
      e.Handled = true;
    }
Esempio n. 12
0
 public virtual void        OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotion(e); }
Esempio n. 13
0
 public virtual void OnPreviewInput(object sender, MouseWheelInputEventArgs e) { e.Handled = GetMotionShaft(e.Wheel) == null; }
Esempio n. 14
0
 public override void OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotionNative(e); }
Esempio n. 15
0
 protected bool TransferMotion(MouseWheelInputEventArgs e)
 {
   var shaft = GetMotionShaft(e.Wheel);
   if (shaft.Transfer(MotionInput, e))
     return true; // client can still move - stop event propagation
   if (NestedMotionEnabled)
     return false; // let the mouse wheel event propagate up the visual tree
   // empty the shaft transfer staging area and stop event propagation
   return shaft.Transfer(NativeMotionTarget.Terminal, e);
 }
Esempio n. 16
0
 protected bool TransferMotionNative(MouseWheelInputEventArgs e)
 {
     return(GetMotionShaft(e.Wheel).Transfer(this, e));
 }
Esempio n. 17
0
 public void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     Behavior.OnInput(sender, e);
 }
Esempio n. 18
0
 public void        OnInput(object sender, MouseWheelInputEventArgs e) { Behavior.OnInput(sender, e); }