public override IEnumerable <Stop> GetGlobalStops(Visual scope, Visual currentElement, DependencyProperty navigationModeProperty) { int scopeTabIndex = KeyboardNavigation.GetTabIndex(scope); if (IsStop((UIElement)scope) || scope == currentElement) { yield return(new Stop(scope, scopeTabIndex)); } // translate stops to have scope tab index instead of local tab index, local order is kept foreach (Stop stop in scope.VisualChildren.SelectMany(child => KeyboardNavigationTarget.GetGlobalStops(child, currentElement, navigationModeProperty)).OrderBy(childStop => childStop.TabIndex)) { yield return(new Stop(stop.Element, scopeTabIndex)); } }
public override Visual FindPreviousTarget(Visual scope, Stop currentStop, DependencyProperty navigationModeProperty, IStopComparerProvider stopComparerProvider) { return(KeyboardNavigationTarget.FindPreviousContainedTarget(scope, currentStop, navigationModeProperty, stopComparerProvider) ?? (scope.VisualParent != null ? KeyboardNavigationTarget.FindPreviousTarget(scope.VisualParent, new Stop(currentStop.Element, KeyboardNavigation.GetTabIndex(scope)), navigationModeProperty, stopComparerProvider) : null)); // translate currentStop and forward request to parent }
public Stop(Visual element) : this(element, KeyboardNavigation.GetTabIndex(element)) { // }