我试图弄清楚如何绑定内容的背景颜色为复选框.这是我的代码,当然背景设置只是改变复选框的颜色而不是文本背后的颜色.
<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>
Run Code Online (Sandbox Code Playgroud)