/// <summary> /// Event raised while the user is dragging a connector. /// </summary> private void ConnectorItem_Dragging(object source, ConnectorItemDraggingEventArgs e) { e.Handled = true; Trace.Assert((ConnectorItem)e.OriginalSource == this.draggedOutConnectorItem); Point mousePoint = Mouse.GetPosition(this); // // Raise an event so that application code can compute intermediate connection points. // var connectionDraggingEventArgs = new ConnectionDraggingEventArgs(ConnectionDraggingEvent, this, this.draggedOutNodeDataContext, this.draggingConnectionDataContext, this.draggedOutConnectorDataContext); RaiseEvent(connectionDraggingEventArgs); // // Figure out if the connection has been dragged over a connector. // ConnectorItem connectorDraggedOver = null; object connectorDataContextDraggedOver = null; bool dragOverSuccess = DetermineConnectorItemDraggedOver(mousePoint, out connectorDraggedOver, out connectorDataContextDraggedOver); if (connectorDraggedOver != null) { // // Raise an event so that application code can specify if the connector // that was dragged over is valid or not. // var queryFeedbackEventArgs = new QueryConnectionFeedbackEventArgs(QueryConnectionFeedbackEvent, this, this.draggedOutNodeDataContext, this.draggingConnectionDataContext, this.draggedOutConnectorDataContext, connectorDataContextDraggedOver); RaiseEvent(queryFeedbackEventArgs); if (queryFeedbackEventArgs.FeedbackIndicator != null) { // // A feedback indicator was specified by the event handler. // This is used to indicate whether the connection is good or bad! // AddFeedbackAdorner(connectorDraggedOver, queryFeedbackEventArgs.FeedbackIndicator); } else { // // No feedback indicator specified by the event handler. // Clear any existing feedback indicator. // ClearFeedbackAdorner(); } } else { // // Didn't drag over any valid connector. // Clear any existing feedback indicator. // ClearFeedbackAdorner(); } }