private static DesignerItem createTriggerItem() { var item = new DesignerItem(); item.Type = ItemType.Trigger; item.Width = 250; item.Height = 250; var control = new DesignerControl(); control.Titel = "New Trigger"; control.ContentGrid.Content = new TriggerControl(); item.Content = control; return item; }
private static DesignerItem createCommandItem() { var item = new DesignerItem(); item.Type = ItemType.Command; item.Width = 250; item.Height = 65; var control = new DesignerControl(); control.Titel = "New Command"; control.ContentGrid.Content = new CommandControl(); item.Content = control; return item; }
void thumbDragThumb_DragStarted(object sender, DragStartedEventArgs e) { this.HitDesignerItem = null; this.HitConnector = null; this.pathGeometry = null; this.Cursor = Cursors.Cross; this.connection.StrokeDashArray = new DoubleCollection(new double[] { 1, 2 }); if (sender == sourceDragThumb) { fixConnector = connection.Sink; dragConnector = connection.Source; } else if (sender == sinkDragThumb) { dragConnector = connection.Sink; fixConnector = connection.Source; } }
private void HitTesting(Point hitPoint) { bool hitConnectorFlag = false; DependencyObject hitObject = designerCanvas.InputHitTest(hitPoint) as DependencyObject; while (hitObject != null && hitObject != sourceConnector.ParentDesignerItem && hitObject.GetType() != typeof(DesignerCanvas)) { if (hitObject is Connector) { HitConnector = hitObject as Connector; hitConnectorFlag = true; } if (hitObject is DesignerItem) { HitDesignerItem = hitObject as DesignerItem; if (!hitConnectorFlag) HitConnector = null; return; } hitObject = VisualTreeHelper.GetParent(hitObject); } HitConnector = null; HitDesignerItem = null; }
void thumbDragThumb_DragCompleted(object sender, DragCompletedEventArgs e) { if (HitConnector != null) { if (connection != null) { if (connection.Source == fixConnector) connection.Sink = this.HitConnector; else connection.Source = this.HitConnector; } } this.HitDesignerItem = null; this.HitConnector = null; this.pathGeometry = null; this.connection.StrokeDashArray = null; this.InvalidateVisual(); }