예제 #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 LeftBoundStopComparer(Stop currentStop)
 {
     currentPosition = KeyboardNavigationTarget.GetLeftBoundPosition(KeyboardNavigationTarget.GetAbsoluteBounds(currentStop.Element));
 }