Closed Aniobodo closed 1 month ago
If it is necessary to change the ComboBoxStyle to ComboBoxStyle.DropDownList before setting the theme, can you try to reset it back to the original style afterwards? .... The code below appears to work well on my side:
if (control is ComboBox comboBox)
{
Mode = IsDarkMode ? "DarkMode_CFD" : "ClearMode_CFD";
control.BeginInvoke(new Action(() => (control as ComboBox).SelectionLength = 0));
Optional<ComboBoxStyle> originalStyle = default;//01.10.2024
if (control.Enabled == false && this.IsDarkMode)
{
originalStyle = new(comboBox.DropDownStyle);//01.10.2024 Status change
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
}
SetWindowTheme(control.Handle, Mode, null);
if (originalStyle.HasValue) comboBox.DropDownStyle = originalStyle.Value;//01.10.2024 reset original status
}
hi, thanks for the suggestions and for the Pull, its merged now. Regards.
There is a line of code that changed the assigned ComboBoxStyle to ComboBoxStyle.DropDownList.
Application of theme should not permanently change control style.