/// <summary> /// Event raised on mouse down in the NetworkView. /// </summary> private void networkControl_MouseDown(object sender, MouseButtonEventArgs e) { NetworkControl.Focus(); Keyboard.Focus(NetworkControl); _mouseButtonDown = e.ChangedButton; _origZoomAndPanControlMouseDownPoint = e.GetPosition(ZoomAndPanControl); _origContentMouseDownPoint = e.GetPosition(NetworkControl); if ((Keyboard.Modifiers & ModifierKeys.Shift) != 0 && (e.ChangedButton == MouseButton.Left || e.ChangedButton == MouseButton.Right)) { // Shift + left- or right-down initiates zooming mode. _mouseHandlingMode = MouseHandlingMode.Zooming; } else if (_mouseButtonDown == MouseButton.Left && (Keyboard.Modifiers & ModifierKeys.Control) == 0) { // // Initiate panning, when control is not held down. // When control is held down left dragging is used for drag selection. // After panning has been initiated the user must drag further than the threshold value to actually start drag panning. // _mouseHandlingMode = MouseHandlingMode.Panning; } if (_mouseHandlingMode != MouseHandlingMode.None) { // Capture the mouse so that we eventually receive the mouse up event. NetworkControl.CaptureMouse(); e.Handled = true; } }