Skip to content

Commit a4103ab

Browse files
Set focus to the search box when the app is loaded
1 parent 4e3c95e commit a4103ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CommunityToolkit.App.Shared/Pages/Shell.xaml.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public Shell()
2727
BackdropMaterial.SetApplyToRootOrPageBackground(this, true);
2828
#endif
2929
Current = this;
30+
31+
Loaded += Shell_Loaded;
3032
}
3133

3234
/// <summary>
@@ -36,9 +38,13 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
3638
{
3739
samplePages = e.Parameter as IEnumerable<ToolkitFrontMatter>;
3840
SetupNavigationMenu();
39-
base.OnNavigatedTo(e);
41+
base.OnNavigatedTo(e);
4042
}
4143

44+
private void Shell_Loaded(object sender, RoutedEventArgs e)
45+
{
46+
searchBox.Focus(FocusState.Programmatic);
47+
}
4248

4349
private void SetupNavigationMenu()
4450
{

0 commit comments

Comments
 (0)