Dynamic Grid - Alignment Guides

Is there currently any way to turn on alignment guides like are available in Visio that will temporarily add lines showing when nodes’ top/middle/etc are aligned? Or do you have any suggestions as to how best implement this feature?

Thanks
Ryan

No, there isn’t a general facility like that that you could turn on.

But you could implement it yourself. I found this code for GoSilverlight that shows an “insertion” line, which is basically like a guideline, as the user drags a node:

// myDiagram.DraggingTool = new VerticalInsertionDraggingTool(); public class VerticalInsertionDraggingTool : DraggingTool { public override void DoActivate() { this.Diagram.Cursor = Cursors.Hand; this.InsertionCursor = CreateInsertionCursor(); this.Diagram.PartsModel.AddNode(this.InsertionCursor); base.DoActivate(); } public override void DoDeactivate() { this.Diagram.Cursor = null; this.Diagram.PartsModel.RemoveNode(this.InsertionCursor); this.InsertionCursor = null; base.DoDeactivate(); } protected Node InsertionCursor { get; set; } protected Node CreateInsertionCursor() { Node n = new Node(); n.Id = "InsertionCursor"; n.LayerName = "Tool"; var line = new System.Windows.Shapes.Line(); line.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); line.StrokeThickness = 1; line.X1 = -1000; line.Y1 = 0; line.X2 = +1000; line.Y2 = 0; n.Content = line; return n; } protected override void DragOver(Point pt, bool moving, bool copying) { if (this.InsertionCursor != null) { double miny = Double.MaxValue; double maxy = Double.MinValue; foreach (Node n in this.Diagram.Nodes) { if (!n.Visible || !n.IsBoundToData) continue; if (moving && this.DraggedParts != null && this.DraggedParts.ContainsKey(n)) continue; if (copying && this.CopiedParts != null && this.CopiedParts.ContainsKey(n)) continue; Rect b = n.Bounds; miny = Math.Min(miny, b.Y); maxy = Math.Max(maxy, b.Y+b.Height); if (b.Y <= pt.Y && pt.Y <= b.Y+b.Height/2) { this.InsertionCursor.Position = new Point(pt.X, b.Y); break; } else if (b.Y+b.Height/2 <= pt.Y && pt.Y <= b.Y+b.Height) { this.InsertionCursor.Position = new Point(pt.X, b.Y+b.Height); break; } } if (pt.Y <= miny && miny < Double.MaxValue) { this.InsertionCursor.Position = new Point(pt.X, miny); } else if (pt.Y >= maxy && maxy > Double.MinValue) { this.InsertionCursor.Position = new Point(pt.X, maxy); } } base.DragOver(pt, moving, copying); } }