. Ответ на предыдущий вопрос (Previous Question). Теперь у меня есть код, который перемещает вкладки вкладок WPF (показано ниже). Он отлично работает, за исключением первой остановки табуляции. Вызов this.MoveFocus (... First), а затем FocusManager.GetFocusedElement возвращает null. Есть идеи? Как получить первую вкладку в моем окне?Поиск первой вкладки вкладки WPF
Спасибо, - Майк
// Select the first element in the window
this.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
TraversalRequest next = new TraversalRequest(FocusNavigationDirection.Next);
List<IInputElement> elements = new List<IInputElement>();
// Get the current element.
UIElement currentElement = FocusManager.GetFocusedElement(this) as UIElement;
while (currentElement != null)
{
elements.Add(currentElement);
// Get the next element.
currentElement.MoveFocus(next);
currentElement = FocusManager.GetFocusedElement(this) as UIElement;
// If we looped (If that is possible), exit.
if (elements[0] == currentElement)
break;
}