protected override void OnPreviewMouseMove(MouseEventArgs e) { base.OnPreviewMouseMove(e); e.Handled = true; if (!_mouseLeftButtonDown) { return; } Point cursorScreenPosition = OpenControls.Wpf.DockManager.Controls.Utilities.GetCursorPosition(); int selectedIndex = GetListBoxItemIndex(cursorScreenPosition); if ((selectedIndex < 0) || (selectedIndex >= Items.Count) || (selectedIndex == _dragIndex)) { Point topLeftPoint = PointToScreen(new Point(0, 0)); if ( (cursorScreenPosition.Y < (topLeftPoint.Y - 30)) || (cursorScreenPosition.Y > (topLeftPoint.Y + ActualHeight + 15)) || (cursorScreenPosition.X < (topLeftPoint.X - 30)) || (cursorScreenPosition.X > (topLeftPoint.X + ActualWidth + 15)) ) { // Cancel further drag processing until we get the next mouse left button down _mouseLeftButtonDown = false; System.Windows.Input.Mouse.Capture(this, CaptureMode.None); System.Diagnostics.Debug.WriteLine("FloatTabRequest: count = " + Items.Count); FloatTabRequest?.Invoke(this, null); } return; } Rect rectSelectedItem = GetListBoxItemBounds(selectedIndex); Rect rectDragItem = GetListBoxItemBounds(_dragIndex); double selectedWidth = rectSelectedItem.Width; double currentWidth = rectDragItem.Width; if (_dragIndex > SelectedIndex) { selectedWidth = -selectedWidth; } rectDragItem.Offset(selectedWidth, 0); if (!rectDragItem.Contains(cursorScreenPosition)) { return; } // Move the item along to the new index var item = Items[_dragIndex]; Items.Remove(item); Items.Insert(selectedIndex, item); _dragIndex = selectedIndex; SelectedIndex = selectedIndex; ItemsChanged?.Invoke(this, null); }
private void IViewContainer_FloatTabRequest(object sender, EventArgs e) { FloatTabRequest?.Invoke(this, e); }
protected void _tabHeaderControl_FloatTabRequest(object sender, EventArgs e) { FloatTabRequest?.Invoke(this, e); }
private void _listBox_FloatTabRequest(object sender, EventArgs e) { FloatTabRequest?.Invoke(this, null); }