private void SetUIFlow(int[] decemberWindowTabIndices) { int temp = 0; DecemberWindow tempDecemberWindow; for (int write = 0; write < decemberWindowTabIndices.Length; write++) { for (int sort = 0; sort < decemberWindowTabIndices.Length - 1; sort++) { if (decemberWindowTabIndices[sort] > decemberWindowTabIndices[sort + 1]) { temp = decemberWindowTabIndices[sort + 1]; decemberWindowTabIndices[sort + 1] = decemberWindowTabIndices[sort]; decemberWindowTabIndices[sort] = temp; tempDecemberWindow = decemberWindows[sort + 1]; decemberWindows[sort + 1] = decemberWindows[sort]; decemberWindows[sort] = tempDecemberWindow; } } } IList <DependencyObject> flowsTo; IList <DependencyObject> flowsFrom; // Set the flow through the UIA tree. for (int i = 1; i < 30; ++i) { flowsTo = AutomationProperties.GetFlowsTo(decemberWindows[i]); flowsTo.Add(decemberWindows[i + 1]); flowsFrom = AutomationProperties.GetFlowsFrom(decemberWindows[i]); flowsFrom.Add(decemberWindows[i - 1]); } flowsTo = AutomationProperties.GetFlowsTo(decemberWindows[0]); flowsTo.Add(decemberWindows[1]); flowsFrom = AutomationProperties.GetFlowsFrom(decemberWindows[0]); flowsFrom.Add(decemberWindows[30]); flowsTo = AutomationProperties.GetFlowsTo(decemberWindows[30]); flowsTo.Add(decemberWindows[0]); flowsFrom = AutomationProperties.GetFlowsFrom(decemberWindows[30]); flowsFrom.Add(decemberWindows[29]); }