[ColorPicker][Settings]Fix duplicate name crash and cleanup (#28713)

This commit is contained in:
Davide Giacometti
2023-09-22 15:57:48 +02:00
committed by GitHub
parent 8d5aa9fe6c
commit b24ae12c5a
3 changed files with 19 additions and 18 deletions

View File

@@ -300,13 +300,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
UpdateColorFormats();
UpdateColorFormatPreview();
ScheduleSavingOfSettings();
}
private void ColorFormat_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdateColorFormats();
ScheduleSavingOfSettings();
// Remaining properties are handled by the collection and by the dialog
if (e.PropertyName == nameof(ColorFormatModel.IsShown))
{
UpdateColorFormats();
ScheduleSavingOfSettings();
}
}
private void ScheduleSavingOfSettings()
@@ -437,6 +440,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
SelectedColorRepresentationValue = colorFormat.Name; // name might be changed by the user
}
UpdateColorFormats();
UpdateColorFormatPreview();
}