Fix a couple of issues with color scheme MVVM (#13646)

## Summary of the Pull Request
- When 'discard changes' is hit, we re-initialize our list of color scheme view models but forgot to tell xaml about it, this commit fixes that. 
- Make sure to exit rename mode when 'update settings' gets called

## References
color schemes mvvm added in #13179 

## PR Checklist
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

## Validation Steps Performed
Hitting discard changes doesn't cause an inconsistency with the currently selected scheme anymore
This commit is contained in:
PankajBhojwani
2022-08-01 19:23:32 -07:00
committed by GitHub
parent 89d57e827e
commit 7976e48195
2 changed files with 4 additions and 1 deletions

View File

@@ -91,7 +91,6 @@
<!-- Select a color scheme -->
<ComboBox x:Name="ColorSchemeComboBox"
ItemsSource="{x:Bind ViewModel.AllColorSchemes, Mode=OneWay}"
SelectedIndex="0"
SelectedItem="{x:Bind ViewModel.CurrentScheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>

View File

@@ -31,6 +31,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
_settings = settings;
// Exit rename mode if we're in it
InRenameMode(false);
// We want to re-initialize our AllColorSchemes list, but we want to make sure
// we still have the same CurrentScheme as before (if that scheme still exists)
@@ -97,6 +100,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
_AllColorSchemes = single_threaded_observable_vector<Editor::ColorSchemeViewModel>(std::move(allColorSchemes));
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"AllColorSchemes" });
}
void ColorSchemesPageViewModel::RequestEnterRename()