Этот вопрос, похоже, не имеет никакого отношения к неработающим миграциям.
Миграции не приводят к появлению модели в админке. Для этого вам нужно зарегистрировать свою модель .
Это делается с помощью MoveFocus, как показано в этой статье MSDN, которая объясняет все о фокусе: Обзор фокуса .
Вот пример кода для перехода к следующему сфокусированному элементу (полученный из этой статьи, слегка измененный).
// MoveFocus takes a TraversalRequest as its argument.
TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next);
// Gets the element with keyboard focus.
UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;
// Change keyboard focus.
if (elementWithFocus != null)
{
elementWithFocus.MoveFocus(request);
}
Вы можете сделать это с помощью вызова MoveFocus. Вы можете получить фокусированный предмет через FocusManager. Следующий код будет перебирать все объекты в окне и добавлять их в список. Обратите внимание, что это будет физически изменять окно, переключая фокус. Скорее всего, код не будет работать, если окно не активно.
// 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;
}