public FreeFormPanel() { this.SnapsToDevicePixels = true; this.AllowDrop = true; connectorEditor = null; lastYPosition = FreeFormPanel.TopStackingMargin; }
public EditPointAdorner(ConnectorEditor cEditor, UIElement adornedElement, bool shouldDrawLines) : base(adornedElement) { Debug.Assert(adornedElement != null, "Adorned element is null."); adornedEditor = cEditor; this.IsHitTestVisible = false; this.drawLines = shouldDrawLines; }
public void RemoveConnectorEditor() { if (connectorEditor != null) { connectorEditor.Remove(); connectorEditor = null; } }
void CreateNewConnectorEditor(MouseButtonEventArgs e) { if (connectorEditor == null || !e.Source.Equals(connectorEditor.Connector)) { //If user clicks anywhere other than the connector editor, destroy it. RemoveConnectorEditor(); if (e.Source.GetType().IsAssignableFrom(typeof(Connector))) { this.connectorEditor = new ConnectorEditor(this, e.Source as Connector); } } }
protected override void OnKeyDown(KeyEventArgs e) { if (e != null && !this.Disabled && this.IsOutmostPanel()) { if (e.Key == Key.Escape) { //If escape key is hit while dragging a connector, end dragging. if (connectorEditor != null && connectorEditor.BeingEdited) { Connector affectedConnector = connectorEditor.Connector; RemoveConnectorEditor(); this.connectorEditor = new ConnectorEditor(this, affectedConnector); e.Handled = true; } } } base.OnKeyDown(e); }