/// <summary> /// Snaps this control to <paramref name="referentialElement"/>. /// </summary> /// <param name="referentialElement">the control that this element is snapped to</param> /// <param name="recalcPosition">if set to <c>true</c> offset is recalculated from current position.</param> public void SnapTo(IReferentialElement referentialElement, bool recalcPosition) { ReferentialElement = referentialElement; referentialElement.FellowTravellers.Add(this); Placement = EPlacementKind.RelativeCanvas; UIElement _uie = referentialElement as UIElement; if (recalcPosition && _uie != null) { this.x = Canvas.GetLeft(this) - Canvas.GetLeft(_uie); this.x = !double.IsNaN(x) ? x : 0; this.y = Canvas.GetTop(this) - Canvas.GetTop(_uie); this.y = !double.IsNaN(y) ? y : 0; } UpdatePos(this); }
public void SnapTo(IReferentialElement referentialElement, bool recalcPosition) { DragThumb.SnapTo(referentialElement, recalcPosition); }