Example #1
0
            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));
                }
            }
Example #2
0
            public override IEnumerable <Stop> GetGlobalStops(Visual scope, Visual currentElement, DependencyProperty navigationModeProperty)
            {
                if (IsStop((UIElement)scope) || scope == currentElement)
                {
                    yield return(new Stop(scope));
                }

                VisualWeakReference navigationFocusElementReference = KeyboardNavigation.GetNavigationFocusElement(scope);
                Visual navigationFocusElement = navigationFocusElementReference != null ? navigationFocusElementReference.Visual : null;

                Stop[] stops = scope.VisualChildren.SelectMany(child => KeyboardNavigationTarget.GetGlobalStops(child, currentElement, navigationModeProperty)).ToArray();

                if (stops.Any())
                {
                    stops = stops.Where(stop => stop.Element == currentElement || stop.Element == navigationFocusElement).DefaultIfEmpty(stops.First()).ToArray();

                    foreach (Stop stop in stops)
                    {
                        yield return(stop);
                    }
                }
            }
Example #3
0
            public override IEnumerable <Stop> GetGlobalStops(Visual scope, Visual currentElement, DependencyProperty navigationModeProperty)
            {
                if (IsStop((UIElement)scope) || scope == currentElement)
                {
                    yield return(new Stop(scope));
                }

                // add currentElement stop if it's a descendant of scope
                if (scope.IsAncestorOf(currentElement))
                {
                    IEnumerable <Stop> childrenStop = scope.VisualChildren.SelectMany(child => KeyboardNavigationTarget.GetGlobalStops(child, currentElement, navigationModeProperty));
                    yield return(childrenStop.First(childStop => childStop.Element == currentElement));
                }
            }