Kinnara / ModernWpf

Modern styles and controls for your WPF applications
MIT License
4.45k stars 446 forks source link

ListBox\ListBoxItem visuals doesn't change via known resource names #510

Open mogikanin opened 2 years ago

mogikanin commented 2 years ago

I've created a simple app to play with this library. By some reason, when I re-define resources related to ListBox\ListBoxItem, there are no visual changes. For other controls, e.g. CheckBox, RadioButton, Button, everything works fine. Am I doing something wrong, or..?

    <StackPanel Orientation="Vertical">
        <StackPanel.Resources>
            <SolidColorBrush x:Key="ListBoxItemBackgroundSelected" Color="Red"/>
            <SolidColorBrush x:Key="ListBoxItemForeground" Color="Red"/>
            <SolidColorBrush x:Key="ListBoxBackground" Color="Red"/>

            <SolidColorBrush x:Key="CheckBoxCheckBackgroundFillUnchecked" Color="Green"/>
            <SolidColorBrush x:Key="RadioButtonBackground" Color="Green"/>
            <SolidColorBrush x:Key="ButtonBackground" Color="Green"/>
        </StackPanel.Resources>

        <ListBox MinHeight="150">
            <ListBox.Items>
                <ListBoxItem>ListBox Item #1</ListBoxItem>
                <ListBoxItem>ListBox Item #2</ListBoxItem>
                <ListBoxItem>ListBox Item #3</ListBoxItem>
            </ListBox.Items>
        </ListBox>

        <CheckBox Content="Checkbox"/>
        <RadioButton Content="RadioButton"/>
        <Button Content="Button"/>
    </StackPanel>

And the output is image