@@ -467,20 +467,20 @@ public bool AreKeyboardAcceleratorsEnabled
467467
468468 public string PathText { get ; set ; }
469469
470- private bool _IsSearchReigonVisible = false ;
470+ private bool _IsSearchRegionVisible = false ;
471471
472- public bool IsSearchReigonVisible
472+ public bool IsSearchRegionVisible
473473 {
474474 get
475475 {
476- return _IsSearchReigonVisible ;
476+ return _IsSearchRegionVisible ;
477477 }
478478 set
479479 {
480- if ( value != _IsSearchReigonVisible )
480+ if ( value != _IsSearchRegionVisible )
481481 {
482- _IsSearchReigonVisible = value ;
483- NotifyPropertyChanged ( "IsSearchReigonVisible " ) ;
482+ _IsSearchRegionVisible = value ;
483+ NotifyPropertyChanged ( "IsSearchRegionVisible " ) ;
484484 }
485485 }
486486 }
@@ -877,30 +877,34 @@ private void Refresh_Click(object sender, RoutedEventArgs e)
877877 RefreshRequested ? . Invoke ( this , EventArgs . Empty ) ;
878878 }
879879
880- private void SearchReigon_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
880+ private void SearchRegion_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
881881 {
882882 SearchQuerySubmitted ? . Invoke ( sender , args ) ;
883883 }
884884
885- private void SearchReigon_TextChanged ( AutoSuggestBox sender , AutoSuggestBoxTextChangedEventArgs args )
885+ private void SearchRegion_TextChanged ( AutoSuggestBox sender , AutoSuggestBoxTextChangedEventArgs args )
886886 {
887887 SearchTextChanged ? . Invoke ( sender , args ) ;
888888 }
889889
890- private void SearchReigon_SuggestionChosen ( AutoSuggestBox sender , AutoSuggestBoxSuggestionChosenEventArgs args )
890+ private void SearchRegion_SuggestionChosen ( AutoSuggestBox sender , AutoSuggestBoxSuggestionChosenEventArgs args )
891891 {
892892 SearchSuggestionChosen ? . Invoke ( sender , args ) ;
893- IsSearchReigonVisible = false ;
893+ IsSearchRegionVisible = false ;
894894 }
895895
896896 private void SearchButton_Click ( object sender , RoutedEventArgs e )
897897 {
898- IsSearchReigonVisible = true ;
898+ IsSearchRegionVisible = true ;
899899
900- SearchReigon . Focus ( FocusState . Programmatic ) ;
900+ // Given that binding and layouting might take a few cycles, when calling UpdateLayout
901+ // we can guarantee that the focus call will be able to find an open ASB
902+ SearchRegion . UpdateLayout ( ) ;
903+
904+ SearchRegion . Focus ( FocusState . Programmatic ) ;
901905 }
902906
903- private void SearchReigon_LostFocus ( object sender , RoutedEventArgs e )
907+ private void SearchRegion_LostFocus ( object sender , RoutedEventArgs e )
904908 {
905909 if ( FocusManager . GetFocusedElement ( ) is FlyoutBase ||
906910 FocusManager . GetFocusedElement ( ) is AppBarButton ||
@@ -909,16 +913,16 @@ private void SearchReigon_LostFocus(object sender, RoutedEventArgs e)
909913 return ;
910914 }
911915
912- SearchReigon . Text = "" ;
913- IsSearchReigonVisible = false ;
916+ SearchRegion . Text = "" ;
917+ IsSearchRegionVisible = false ;
914918 }
915919
916- public void ClearSearchBoxQueryText ( bool collapseSearchReigon = false )
920+ public void ClearSearchBoxQueryText ( bool collapseSearchRegion = false )
917921 {
918- SearchReigon . Text = "" ;
919- if ( IsSearchReigonVisible && collapseSearchReigon )
922+ SearchRegion . Text = "" ;
923+ if ( IsSearchRegionVisible && collapseSearchRegion )
920924 {
921- IsSearchReigonVisible = false ;
925+ IsSearchRegionVisible = false ;
922926 }
923927 }
924928
0 commit comments