DataGridCheckBoxColumn 工作不正常
我刚刚创建了一个 DataGrid:
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn ... />
<DataGridCheckBoxColumn Binding="{Binding Path=IsEditing, Mode=TwoWay}" Header="IsEditing" />
</DataGrid.Columns>
</DataGrid>
我的问题是当我想首先选中记录内的此复选框时,该行被选中,然后我才能选中此复选框...这是非常不舒服的...此外...当我选择另一行时,创建此 DataGrid 的对象的依赖属性事件也会运行。
为了更清楚地说明,我将逐步向您解释:
- 我想选择将运行依赖属性事件的项目。
- 我单击复选框,但仅选择了已检查的行
- 我必须再次单击复选框来检查它,但事件也没有运行
- 我必须单击/选择其他行才能运行最后选定的对象/行的依赖属性的事件
为什么这工作这么糟糕吗?有什么选项可以让它对用户(对我来说也是)更舒适地工作吗?
I just created a DataGrid:
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn ... />
<DataGridCheckBoxColumn Binding="{Binding Path=IsEditing, Mode=TwoWay}" Header="IsEditing" />
</DataGrid.Columns>
</DataGrid>
My problem is that when I want to check this checkbox inside record at first the row is selected and only then I can check this checkbox... It is Very Uncomfortable... And in addition... event for dependency property of objects for which is created this DataGrid also runs when I will select another row.
To be more clearly I will explain you step by step:
- I want to select item which will run event of dependency property.
- I click on checkbox but insted of cheched only row is selected
- I must click AGAIN on checbox to check it, but event also doesn't run
- I must click/select other row to make run event of dependency property of last selected object/row
Why this is working so terrible? Is there any option to make it working more comfortable for user(for me also)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要为 DataGrid 添加 MouseLeftButtonUp 事件:
You will need to add a MouseLeftButtonUp event for the DataGrid:
将属性 IsThreeState = "False" 添加到 DataGridCheckBoxColumn
Add Property IsThreeState = "False" to the DataGridCheckBoxColumn