diff --git a/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs b/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs index 28bee5d872..56b4321711 100644 --- a/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs +++ b/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs @@ -2,12 +2,12 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.WinUI.Controls; using DevHome.Common.Contracts; using DevHome.Common.Extensions; using DevHome.Common.Models; @@ -158,7 +158,7 @@ public bool ShowRepositoryStatus } [RelayCommand] - public async Task AddFolderClick() + public async Task AddFolderClick(object sender) { StorageFolder? repoRootFolder = null; if (IsFeatureEnabled) @@ -187,6 +187,7 @@ await Task.Run(async () => } }); RefreshTrackedRepositories(); + AdjustFocus(sender); } return repoRootFolder == null ? string.Empty : repoRootFolder.Path; @@ -292,4 +293,17 @@ public async void OnToggledRepositoryStatusSettingAsync(bool value) await LocalSettingsService!.SaveSettingAsync("ShowRepositoryStatus", value); } + + private void AdjustFocus(object sender) + { + var addRepositoryCard = sender as SettingsCard; + if (addRepositoryCard != null) + { + addRepositoryCard.IsTabStop = true; + _log.Debug($"AddRepositoryCard IsEnabled: {addRepositoryCard.IsEnabled}"); + _log.Debug($"AddRepositoryCard Visibility: {addRepositoryCard.Visibility}"); + bool isFocusSet = addRepositoryCard.Focus(FocusState.Keyboard); + _log.Information($"Set focus to add reposiotry card result: {isFocusSet}"); + } + } } diff --git a/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml b/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml index 6c22bf4474..d4056b80cc 100644 --- a/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml +++ b/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml @@ -15,11 +15,13 @@ Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>