【发布时间】:2013-12-27 00:40:50
【问题描述】:
我试图弄清楚如何为复选框绑定内容的背景颜色。这是我的代码,当然背景设置只是改变复选框的颜色而不是文本后面的颜色。
<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>
【问题讨论】:
-
我使用了下面文章中显示的“复选框”样式。没有它,我在我们的一台 Windows Server 2008 机器上看到白色背景上的白色刻度:eidias.com/blog/2012/6/1/…