I am developing a WPF application that must run using Windows Classic theme. The application creates a dialog box containing a ListBox. When the dialog box is shown, it must be disabled for 1s before accepting any input. I am accomplishing this with a style trigger, and it works. However, the ListBox shows a white background when it's disabled, which I can't seem to get rid of. When using the aero theme, the following style resource fixes the issue:
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
But when using Windows Classic theme, the white background reappears. How can i remedy the situation for Classic theme???
After further research, I discovered that the Windows Classic theme uses WindowBrushKey instead of ControlBrushKey. Therefore, this fixes the issue for both Aero and Classic themes:
<Style TargetType="{x:Type ListBox}">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Transparent"/>
</Style.Resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With