/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); if (e.MouseButton == MouseButton.Left) { e.Handled = UpdateSelectionFromEventSource(e.Source); } }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); if (e.MouseButton == MouseButton.Left || e.MouseButton == MouseButton.Right) { e.Handled = UpdateSelectionFromEventSource( e.Source, true, (e.InputModifiers & InputModifiers.Shift) != 0, (e.InputModifiers & InputModifiers.Control) != 0); } }
protected override void OnPointerPressed(PointerPressedEventArgs e) { e.Device.Capture(this); _lastPoint = e.GetPosition(this); var ev = new VectorEventArgs { RoutedEvent = DragStartedEvent, Vector = (Vector)_lastPoint, }; RaiseEvent(ev); }
/// <summary> /// Called when the pointer is pressed anywhere on the window. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The event args.</param> private void TopLevelPreviewPointerPress(object sender, PointerPressedEventArgs e) { if (IsOpen) { var control = e.Source as ILogical; if (!this.IsLogicalParentOf(control)) { Close(); } } }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { if (!IsDropDownOpen && ((IVisual)e.Source).GetVisualRoot() != typeof(PopupRoot)) { IsDropDownOpen = true; e.Handled = true; } if (!e.Handled) { if (UpdateSelectionFromEventSource(e.Source)) { _popup?.Close(); e.Handled = true; } } base.OnPointerPressed(e); }
private void PointerPressedOutside(object sender, PointerPressedEventArgs e) { if (!StaysOpen) { var root = ((IVisual)e.Source).GetVisualRoot(); if (root != this.PopupRoot) { Close(); e.Handled = true; } } }
/// <summary> /// Called before the <see cref="PointerPressed"/> event occurs. /// </summary> /// <param name="e">The event args.</param> protected virtual void OnPointerPressed(PointerPressedEventArgs e) { }
private bool MouseDown(IMouseDevice device, uint timestamp, IInputElement root, Point p, MouseButton button, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { var settings = PerspexLocator.Current.GetService<IPlatformSettings>(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) { _clickCount = 0; } ++_clickCount; _lastClickTime = timestamp; _lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressedEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, Source = source, ClickCount = _clickCount, MouseButton = button, InputModifiers = inputModifiers }; source.RaiseEvent(e); return e.Handled; } } return false; }
/// <summary> /// Called when the pointer is pressed over the <see cref="MenuItem"/>. /// </summary> /// <param name="e">The event args.</param> protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); if (!HasSubMenu) { RaiseEvent(new RoutedEventArgs(ClickEvent)); } else if (IsTopLevel) { IsSubMenuOpen = !IsSubMenuOpen; } else { IsSubMenuOpen = true; } e.Handled = true; }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { // Ignore pointer presses. }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); PseudoClasses.Add(":pressed"); e.Device.Capture(this); e.Handled = true; if (ClickMode == ClickMode.Press) { RaiseClickEvent(); } }