我有一个带有复选框和其他文本框的 DataGrid。
<DataGrid AutoGenerateColumns="False" Height="170" Name="dataGrid1" Width="527" OpacityMask="#FF161A1A" BorderBrush="#FFB7B39D" Background="LightYellow" RowBackground="LightGray" AlternatingRowBackground="#FFFFFFF5" BorderThickness="10" CanUserResizeRows="False" CanUserReorderColumns="False" CanUserResizeColumns="True" CanUserSortColumns="False" FontFamily="Segoe UI" FontSize="13" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="" Binding="{Binding BoolProperty, Mode=TwoWay}" />
<DataGridTextColumn Header="" Binding="{Binding header}" MinWidth="108" IsReadOnly="True" />
<DataGridTextColumn Header="Number of Cases" Binding="{Binding cases}" >
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<Setter Property="IsEnabled" Value="{Binding Path=BoolProperty, Mode=TwoWay}" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
复选框列绑定到“BoolProperty”。如果 BoolProperty 为假,我希望禁用文本框“案例数”,如果 BoolProperty 为真,则启用。我尝试在 TExtBox 中添加 IsEnabled,但它不起作用。我哪里错了?