[英]WPF disable DataGrid Cell
我想基于数据库返回的程序禁用[只读] DataGridCell
。 我正在使用以下代码,但无法正常工作
<DataGridTextColumn Width="SizeToCells" x:Name="amountColumn" Header="Amount" Binding="{Binding Amount}" MinWidth="100" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding RoleName}" Value="Payment Authoriser" >
<Setter Property="Background" Value="#DDA0DC" />
<Setter Property="ToolTip" Value="Please Add Amount" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<Setter Property="DedableThisCell" Value="Please DesableMe" />
GridCell
将只有写在RoleName="Payment Maker"
的还有什么别的RoleName
,这将是只读的。
你尝试过这样的事情吗?
<DataTrigger Binding="{Binding RoleName}" Value="Payment Maker" >
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.