有什么方法可以将一些数据上下文的属性值绑定到 IsReadOnly 属性?
例如:
<toolkit:DataGridTemplateColumn Header="MyColumn" Width="160" IsReadOnly="{Binding Path=BooleanPropertyFromMyViewModel, Converter={StaticResource InvertBoolConv}}"/>
或者我应该创建一个 DataTrigger?
有什么方法可以将一些数据上下文的属性值绑定到 IsReadOnly 属性?
例如:
<toolkit:DataGridTemplateColumn Header="MyColumn" Width="160" IsReadOnly="{Binding Path=BooleanPropertyFromMyViewModel, Converter={StaticResource InvertBoolConv}}"/>
或者我应该创建一个 DataTrigger?
I don't have the toolkit installed on this machine, but if IsReadOnly is a dependency property, that should work just fine.
Once I have access to may main development machine, I'll confirm it, but if you're not seeing the behavior you expect from it I would check the output window for any binding errors.
If you're using WPF 4, you can use Tracing as described in Pete Brown's blog post here.