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);
            }
        }
Exemplo 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));
        }
Exemplo n.º 5
0
 public virtual void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotion(e);
 }
Exemplo n.º 6
0
 public virtual void OnPreviewInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = GetMotionShaft(e.Wheel) == null;
 }
Exemplo n.º 7
0
 public override void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotionNative(e);
 }
Exemplo n.º 8
0
 protected bool TransferMotionNative(MouseWheelInputEventArgs e)
 {
   return GetMotionShaft(e.Wheel).Transfer(this as INativeMotionTarget, e);
 }
Exemplo n.º 9
0
 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);
   }
 }
Exemplo 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);
 }
Exemplo 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;
    }
Exemplo n.º 12
0
 public virtual void        OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotion(e); }
Exemplo n.º 13
0
 public virtual void OnPreviewInput(object sender, MouseWheelInputEventArgs e) { e.Handled = GetMotionShaft(e.Wheel) == null; }
Exemplo n.º 14
0
 public override void OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotionNative(e); }
Exemplo 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);
 }
Exemplo n.º 16
0
 protected bool TransferMotionNative(MouseWheelInputEventArgs e)
 {
     return(GetMotionShaft(e.Wheel).Transfer(this, e));
 }
Exemplo n.º 17
0
 public void OnInput(object sender, MouseWheelInputEventArgs e)
 {
     Behavior.OnInput(sender, e);
 }
Exemplo n.º 18
0
 public void        OnInput(object sender, MouseWheelInputEventArgs e) { Behavior.OnInput(sender, e); }