Changing the background color of a locked list in a classic Windows theme

I am developing a WPF application that should run using the Windows Classic theme. An application creates a dialog box containing a ListBox. When a dialog box appears, it must be disabled for 1 second before accepting any input. I accomplish this with a style trigger and it works. However, the ListBox shows a white background when it is disabled, and I cannot get rid of it. When using the aero theme, the following style resource fixes the problem:

<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> 

But when using the Windows Classic theme, a white background appears again. How can I fix the situation for a classic theme ???

+6
wpf themes aero
source share
1 answer

After further research, I found that the Windows Classic theme uses WindowBrushKey instead of ControlBrushKey. Therefore, this fixes the problem 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> 
+9
source share

All Articles