diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.cpp b/src/cascadia/TerminalSettingsEditor/AddProfile.cpp index 061a874ff07..15fd71138ae 100644 --- a/src/cascadia/TerminalSettingsEditor/AddProfile.cpp +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.cpp @@ -39,4 +39,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _State.RequestDuplicate(selected.try_as().Guid()); } } + + void AddProfile::ProfilesSelectionChanged(const IInspectable& /*sender*/, + const Windows::UI::Xaml::RoutedEventArgs& /*eventArgs*/) + { + if (!_IsProfileSelected) + { + IsProfileSelected(true); + } + } } diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.h b/src/cascadia/TerminalSettingsEditor/AddProfile.h index 5eaedbbad22..938d5151251 100644 --- a/src/cascadia/TerminalSettingsEditor/AddProfile.h +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.h @@ -52,8 +52,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void AddNewClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); void DuplicateClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); + void ProfilesSelectionChanged(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); WINRT_PROPERTY(Editor::AddProfilePageNavigationState, State, nullptr); + WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); + WINRT_OBSERVABLE_PROPERTY(bool, IsProfileSelected, _PropertyChangedHandlers, nullptr); }; } diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.idl b/src/cascadia/TerminalSettingsEditor/AddProfile.idl index 82ee2a64e44..480c69bcbe1 100644 --- a/src/cascadia/TerminalSettingsEditor/AddProfile.idl +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.idl @@ -13,9 +13,10 @@ namespace Microsoft.Terminal.Settings.Editor event AddNewArgs AddNew; }; - [default_interface] runtimeclass AddProfile : Windows.UI.Xaml.Controls.Page + [default_interface] runtimeclass AddProfile : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged { AddProfile(); AddProfilePageNavigationState State { get; }; + Boolean IsProfileSelected { get; }; } } diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.xaml b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml index fb67b1f457c..ead73a4eebb 100644 --- a/src/cascadia/TerminalSettingsEditor/AddProfile.xaml +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml @@ -41,7 +41,8 @@ + ItemsSource="{x:Bind State.Settings.AllProfiles, Mode=OneWay}" + SelectionChanged="ProfilesSelectionChanged">