fix settings ui issue

This commit is contained in:
Yu Leng
2025-11-17 16:13:52 +08:00
parent f05740b0cb
commit 15e6a762d3
2 changed files with 14 additions and 2 deletions

View File

@@ -406,6 +406,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library
return string.Join(System.Environment.NewLine, lines);
}
/// <summary>
/// Refreshes the ColorTemperature property binding to force UI re-evaluation.
/// Called after AvailableColorPresets is populated to sync ComboBox selection.
/// </summary>
public void RefreshColorTemperatureBinding()
{
OnPropertyChanged(nameof(ColorTemperature));
}
/// <summary>
/// Represents a color temperature preset item for VCP code 0x14
/// </summary>

View File

@@ -327,9 +327,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
// Sort by VCP value for consistent ordering
presetList = presetList.OrderBy(p => p.VcpValue).ToList();
// Create new collection and assign it - this triggers property setter
// which will call UpdateSelectedColorPresetFromTemperature() to sync the selection
// Create new collection and assign it
monitor.AvailableColorPresets = new ObservableCollection<MonitorInfo.ColorPresetItem>(presetList);
// Refresh ColorTemperature binding to force ComboBox to re-evaluate SelectedValue
// and match it against the newly populated AvailableColorPresets
monitor.RefreshColorTemperatureBinding();
}
/// <summary>