How to set the background color of a checkbox's content by binding in WPF

Viewed 9747

I am trying to figure out how to bind the background color of the content for a checkbox. Here is the code I have, of course the background setting just changes the color of the checkbox not the color behind the text.

        <ListBox Name="ListBox1" ItemsSource="{Binding Path=relationshipTypesTable.dataTable.DefaultView}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox IsChecked="True" Content="{Binding typeDesc}" Background="{Binding color}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
2 Answers
Related