【发布时间】:2012-11-08 13:39:21
【问题描述】:
我想更改 DataGridCell 的内容。我在 datagridview 中有这样的列
<DataGridCheckBoxColumn CellStyle="ChangeContentOfCellSstyle"...
然后我有一个像这样的 DataTrigger:
<Style TargetType="DataGridCell" x:Key="ChangeContentOfCellSstyle">
<Style.Triggers>
<DataTrigger Binding="{Binding IsWashed}" Value="True">
<Setter Property="Content" Value="The new value for the cell."/>
<Setter Property="Background" Value="Red"/> //sets the background of the cell to red just to show the trigger is working
</DataTrigger>
</Style.Triggers>
</Style>
但是单元格的内容并没有改变。即使我尝试对 DataGridTextColumn 进行相同操作,尽管单元格变为红色。
【问题讨论】:
标签: c# wpf binding datatrigger datagridcell