且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更改Windows经典主题中的禁用列表框的背景颜色

更新时间:2023-01-26 19:09:21

经过进一步研究,我发现Windows经典主题使用WindowBrushKey而不是ControlBrushKey。因此,这可以解决Aero和Classic主题的问题:

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>