示例#1
0
            public int Compare(Stop x, Stop y)
            {
                Point relativePosition1 = KeyboardNavigationTarget.GetLeftBoundPosition(KeyboardNavigationTarget.GetAbsoluteBounds(x.Element)) - currentPosition;
                Point relativePosition2 = KeyboardNavigationTarget.GetLeftBoundPosition(KeyboardNavigationTarget.GetAbsoluteBounds(y.Element)) - currentPosition;

                double distance1 = relativePosition1.X < 0 ? -relativePosition1.GetLengthSqr() : relativePosition1.GetLengthSqr();
                double distance2 = relativePosition2.X < 0 ? -relativePosition2.GetLengthSqr() : relativePosition2.GetLengthSqr();

                return(distance1.CompareTo(distance2));
            }
示例#2
0
 public RightBoundStopComparer(Stop currentStop)
 {
     currentPosition = KeyboardNavigationTarget.GetRightBoundPosition(KeyboardNavigationTarget.GetAbsoluteBounds(currentStop.Element));
 }