コード例 #1
0
ファイル: DragThumb.cs プロジェクト: mff-uk/xcase
        /// <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);
        }
コード例 #2
0
ファイル: Node.cs プロジェクト: mff-uk/exolutio
 public void SnapTo(IReferentialElement referentialElement, bool recalcPosition)
 {
     DragThumb.SnapTo(referentialElement, recalcPosition);
 }