@@ -177,7 +177,7 @@ private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedE
177177 if ( mode == OmnibarPathMode )
178178 {
179179 await ViewModel . HandleItemNavigationAsync ( args . Text ) ;
180- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
180+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
181181 return ;
182182 }
183183
@@ -197,7 +197,7 @@ private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedE
197197 continue ;
198198
199199 await command . ExecuteAsync ( ) ;
200- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
200+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
201201 return ;
202202 }
203203
@@ -214,14 +214,14 @@ private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedE
214214 await overload ? . InvokeAsync ( actionInstance . Context ) ;
215215 }
216216
217- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
217+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
218218 return ;
219219 }
220220
221221 await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidCommand . GetLocalizedResource ( ) ,
222222 string . Format ( Strings . InvalidCommandContent . GetLocalizedResource ( ) , args . Text ) ) ;
223223
224- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
224+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
225225 return ;
226226 }
227227
@@ -242,7 +242,7 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedRes
242242 ViewModel . SaveSearchQueryToList ( searchQuery ) ;
243243 }
244244
245- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
245+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
246246 return ;
247247 }
248248 }
@@ -423,7 +423,7 @@ private async void Omnibar_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
423423 if ( e . Key is VirtualKey . Escape )
424424 {
425425 Omnibar . IsFocused = false ;
426- ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
426+ ContentPageContext . ShellPage ! . PaneHolder . FocusActivePane ( ) ;
427427 }
428428 else if ( e . Key is VirtualKey . Tab && Omnibar . IsFocused && ! InputKeyboardSource . GetKeyStateForCurrentThread ( VirtualKey . Shift ) . HasFlag ( CoreVirtualKeyStates . Down ) )
429429 {
0 commit comments