示例#1
0
 protected virtual void ComputeIdealAlignment()
 {
     this.Settings.HorizontalAlignment = (this.WidthConstraintMode & LayoutConstraintMode.CanvasLike) == LayoutConstraintMode.NonOverlappingGridlike ? (!Tolerances.LessThanOrClose(this.ChildRect.Right, (this.SlotRect.Left + this.SlotRect.Right) / 2.0) ? (!Tolerances.GreaterThanOrClose(this.ChildRect.Left, (this.SlotRect.Left + this.SlotRect.Right) / 2.0) ? HorizontalAlignment.Stretch : HorizontalAlignment.Right) : HorizontalAlignment.Left) : HorizontalAlignment.Stretch;
     if ((this.HeightConstraintMode & LayoutConstraintMode.CanvasLike) != LayoutConstraintMode.NonOverlappingGridlike)
     {
         this.Settings.VerticalAlignment = VerticalAlignment.Stretch;
     }
     else if (Tolerances.LessThanOrClose(this.ChildRect.Bottom, (this.SlotRect.Top + this.SlotRect.Bottom) / 2.0))
     {
         this.Settings.VerticalAlignment = VerticalAlignment.Top;
     }
     else if (Tolerances.GreaterThanOrClose(this.ChildRect.Top, (this.SlotRect.Top + this.SlotRect.Bottom) / 2.0))
     {
         this.Settings.VerticalAlignment = VerticalAlignment.Bottom;
     }
     else
     {
         this.Settings.VerticalAlignment = VerticalAlignment.Stretch;
     }
 }