@@ -467,20 +467,20 @@ public bool AreKeyboardAcceleratorsEnabled
467
467
468
468
public string PathText { get ; set ; }
469
469
470
- private bool _IsSearchReigonVisible = false ;
470
+ private bool _IsSearchRegionVisible = false ;
471
471
472
- public bool IsSearchReigonVisible
472
+ public bool IsSearchRegionVisible
473
473
{
474
474
get
475
475
{
476
- return _IsSearchReigonVisible ;
476
+ return _IsSearchRegionVisible ;
477
477
}
478
478
set
479
479
{
480
- if ( value != _IsSearchReigonVisible )
480
+ if ( value != _IsSearchRegionVisible )
481
481
{
482
- _IsSearchReigonVisible = value ;
483
- NotifyPropertyChanged ( "IsSearchReigonVisible " ) ;
482
+ _IsSearchRegionVisible = value ;
483
+ NotifyPropertyChanged ( "IsSearchRegionVisible " ) ;
484
484
}
485
485
}
486
486
}
@@ -877,30 +877,34 @@ private void Refresh_Click(object sender, RoutedEventArgs e)
877
877
RefreshRequested ? . Invoke ( this , EventArgs . Empty ) ;
878
878
}
879
879
880
- private void SearchReigon_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
880
+ private void SearchRegion_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
881
881
{
882
882
SearchQuerySubmitted ? . Invoke ( sender , args ) ;
883
883
}
884
884
885
- private void SearchReigon_TextChanged ( AutoSuggestBox sender , AutoSuggestBoxTextChangedEventArgs args )
885
+ private void SearchRegion_TextChanged ( AutoSuggestBox sender , AutoSuggestBoxTextChangedEventArgs args )
886
886
{
887
887
SearchTextChanged ? . Invoke ( sender , args ) ;
888
888
}
889
889
890
- private void SearchReigon_SuggestionChosen ( AutoSuggestBox sender , AutoSuggestBoxSuggestionChosenEventArgs args )
890
+ private void SearchRegion_SuggestionChosen ( AutoSuggestBox sender , AutoSuggestBoxSuggestionChosenEventArgs args )
891
891
{
892
892
SearchSuggestionChosen ? . Invoke ( sender , args ) ;
893
- IsSearchReigonVisible = false ;
893
+ IsSearchRegionVisible = false ;
894
894
}
895
895
896
896
private void SearchButton_Click ( object sender , RoutedEventArgs e )
897
897
{
898
- IsSearchReigonVisible = true ;
898
+ IsSearchRegionVisible = true ;
899
899
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 ) ;
901
905
}
902
906
903
- private void SearchReigon_LostFocus ( object sender , RoutedEventArgs e )
907
+ private void SearchRegion_LostFocus ( object sender , RoutedEventArgs e )
904
908
{
905
909
if ( FocusManager . GetFocusedElement ( ) is FlyoutBase ||
906
910
FocusManager . GetFocusedElement ( ) is AppBarButton ||
@@ -909,16 +913,16 @@ private void SearchReigon_LostFocus(object sender, RoutedEventArgs e)
909
913
return ;
910
914
}
911
915
912
- SearchReigon . Text = "" ;
913
- IsSearchReigonVisible = false ;
916
+ SearchRegion . Text = "" ;
917
+ IsSearchRegionVisible = false ;
914
918
}
915
919
916
- public void ClearSearchBoxQueryText ( bool collapseSearchReigon = false )
920
+ public void ClearSearchBoxQueryText ( bool collapseSearchRegion = false )
917
921
{
918
- SearchReigon . Text = "" ;
919
- if ( IsSearchReigonVisible && collapseSearchReigon )
922
+ SearchRegion . Text = "" ;
923
+ if ( IsSearchRegionVisible && collapseSearchRegion )
920
924
{
921
- IsSearchReigonVisible = false ;
925
+ IsSearchRegionVisible = false ;
922
926
}
923
927
}
924
928
0 commit comments