private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e) { var originalSource = GetOriginalSource(e); var ie = new MouseWheelInputEventArgs(this, e.MouseDevice.GetWheel(), e.Timestamp, e.Delta, Orientation.Vertical); OnPreviewMouseWheel(originalSource, ie); e.Handled = true; }
private void OnPreviewInput(object sender, MouseWheelInputEventArgs e) { Debug.Assert(sender == Element); var client = _clients.FirstOrDefault(c => c.IsActive(e)); if (client != null) { client.OnPreviewInput(sender, e); } }
public override bool IsActive(MouseWheelInputEventArgs e) { if (e.Orientation == Orientation.Horizontal) { EnsureLoaded(); return(Orientation == Orientation.Horizontal); } else { return(base.IsActive(e)); } }
private void OnInput(object sender, MouseWheelInputEventArgs e) { Debug.Assert(sender == Element); e.Controller = this; var client = _clients.FirstOrDefault(c => c.IsActive(e)); if (client != null) { _exitElement = client.ExitElement; client.OnInput(sender, e); } }
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)); }
private IntPtr MouseHorizontalWheelHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { switch (msg) { case WM_MOUSEHWHEEL: { var timestamp = Environment.TickCount; var originalSource = Mouse.DirectlyOver; var delta = (short)unchecked ((uint)(long)wParam >> 16); var ie = new MouseWheelInputEventArgs(this, MouseWheel.Current, timestamp, -delta, Orientation.Horizontal); OnPreviewMouseWheel(originalSource, ie); break; } } return(IntPtr.Zero); }
public virtual void OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotion(e); }
public virtual void OnPreviewInput(object sender, MouseWheelInputEventArgs e) { e.Handled = GetMotionShaft(e.Wheel) == null; }
public override void OnInput(object sender, MouseWheelInputEventArgs e) { e.Handled = TransferMotionNative(e); }
protected bool TransferMotionNative(MouseWheelInputEventArgs e) { return(GetMotionShaft(e.Wheel).Transfer(this as INativeMotionTarget, e)); }
public override bool IsActive(MouseWheelInputEventArgs e) { return(e.Orientation == Orientation.Vertical && base.IsActive(e)); }
private void OnPreviewMouseWheel(IInputElement originalSource, MouseWheelInputEventArgs ie) { // Update wheel motion info var info = ie.Wheel.PreTransmit(ie.Timestamp, ie.Delta); // 1. Tunneling event // Clients and behaviors use this tunneling event to update the wheel transfer // case by dynamically creating / retrieving motion shafts. ie.RoutedEvent = PreviewMouseWheelInputEvent; originalSource.RaiseEvent(ie); // 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 (ie.Handled) { return; } // Fill motion reservoir ie.Wheel.Transmit(info, ie.Delta, null); // 2. Bubbling event // Clients consume the motion here ie.RoutedEvent = MouseWheelInputEvent; originalSource.RaiseEvent(ie); // 3. Remaining motion is processed here ie.EndCommand(); }
public void OnInput(object sender, MouseWheelInputEventArgs e) { Behavior.OnInput(sender, e); }
public virtual bool IsActive(MouseWheelInputEventArgs e) { EnsureLoaded(); return(Modifiers == Keyboard.Modifiers); }