private static IInputElement?GetPrevTabWithSameIndex(IInputElement e, IInputElement container) { int elementTabPriority = KeyboardNavigation.GetTabIndex(e); var currElement = GetPreviousInTree(e, container); while (currElement != null) { if (IsTabStopOrGroup(currElement) && KeyboardNavigation.GetTabIndex(currElement) == elementTabPriority && currElement != container) { return(currElement); } currElement = GetPreviousInTree(currElement, container); } return(null); }
private static IInputElement?GetNextTabWithSameIndex(IInputElement e, IInputElement container) { var elementTabPriority = KeyboardNavigation.GetTabIndex(e); var currElement = e; while ((currElement = GetNextInTree(currElement, container)) != null) { if (IsTabStopOrGroup(currElement) && KeyboardNavigation.GetTabIndex(currElement) == elementTabPriority) { return(currElement); } } return(null); }
private static IInputElement?GetPrevTabWithPrevIndex(IInputElement e, IInputElement container, KeyboardNavigationMode tabbingType) { // Find the next max index in the tree // max (index<currentTabIndex) IInputElement?lastTabElement = null; IInputElement?nextTabElement = null; int elementTabPriority = KeyboardNavigation.GetTabIndex(e); int maxIndexFirstTab = Int32.MaxValue; int maxIndex = Int32.MaxValue; var currElement = GetLastInTree(container); while (currElement != null) { if (IsTabStopOrGroup(currElement) && currElement != container) { int currPriority = KeyboardNavigation.GetTabIndex(currElement); if (currPriority < elementTabPriority) { if (currPriority > maxIndex || nextTabElement == null) { maxIndex = currPriority; nextTabElement = currElement; } } if (currPriority > maxIndexFirstTab || lastTabElement == null) { maxIndexFirstTab = currPriority; lastTabElement = currElement; } } currElement = GetPreviousInTree(currElement, container); } // Cycle groups: if not found - return first element if (tabbingType == KeyboardNavigationMode.Cycle && nextTabElement == null) { nextTabElement = lastTabElement; } return(nextTabElement); }
private static IInputElement?GetNextTabWithNextIndex(IInputElement e, IInputElement container, KeyboardNavigationMode tabbingType) { // Find the next min index in the tree // min (index>currentTabIndex) IInputElement?nextTabElement = null; IInputElement?firstTabElement = null; int minIndexFirstTab = int.MinValue; int minIndex = int.MinValue; int elementTabPriority = KeyboardNavigation.GetTabIndex(e); IInputElement?currElement = container; while ((currElement = GetNextInTree(currElement, container)) != null) { if (IsTabStopOrGroup(currElement)) { int currPriority = KeyboardNavigation.GetTabIndex(currElement); if (currPriority > elementTabPriority) { if (currPriority < minIndex || nextTabElement == null) { minIndex = currPriority; nextTabElement = currElement; } } if (currPriority < minIndexFirstTab || firstTabElement == null) { minIndexFirstTab = currPriority; firstTabElement = currElement; } } } // Cycle groups: if not found - return first element if (tabbingType == KeyboardNavigationMode.Cycle && nextTabElement == null) { nextTabElement = firstTabElement; } return(nextTabElement); }
private static IInputElement?GetLastTabInGroup(IInputElement container) { IInputElement?lastTabElement = null; int maxIndexFirstTab = int.MaxValue; var currElement = GetLastInTree(container); while (currElement != null && currElement != container) { if (IsTabStopOrGroup(currElement)) { int currPriority = KeyboardNavigation.GetTabIndex(currElement); if (currPriority > maxIndexFirstTab || lastTabElement == null) { maxIndexFirstTab = currPriority; lastTabElement = currElement; } } currElement = GetPreviousInTree(currElement, container); } return(lastTabElement); }
private static IInputElement?GetFirstTabInGroup(IInputElement container) { IInputElement?firstTabElement = null; int minIndexFirstTab = int.MinValue; var currElement = container; while ((currElement = GetNextInTree(currElement, container)) != null) { if (IsTabStopOrGroup(currElement)) { int currPriority = KeyboardNavigation.GetTabIndex(currElement); if (currPriority < minIndexFirstTab || firstTabElement == null) { minIndexFirstTab = currPriority; firstTabElement = currElement; } } } return(firstTabElement); }