我正在尝试更改 DataGridTextColumn 的颜色。
这就是我正在做的事情:
<DataGridTextColumn
Header="Status"
Binding="{Binding IsActive,
Converter= {StaticResource BoolToStatusConverter}}"
Foreground="{Binding Path=IsActive,
Converter={StaticResource BoolToColorConverter}}"/>
文本设置正确,但颜色不会改变,我收到以下错误:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or
FrameworkContentElement for target element. BindingExpression:Path=IsActive;
DataItem=null; target element is 'DataGridTextColumn' (HashCode=40349079); target
property is 'Foreground' (type 'Brush')
我应该怎么做才能使它起作用?