有条件地使 WPF DataGridCell 成为只读 [英] Conditionally making readonly to WPF DataGridCell

查看:20
本文介绍了有条件地使 WPF DataGridCell 成为只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况需要有条件地将 wpf 数据网格单元设为只读.DataGridCell 中有 IsReadOnly 属性.但不幸的是,该属性是只读的!有什么办法吗?
蚂蚁.

I have a situation that needs to conditionally make readonly to wpf datagrid cell. There is IsReadOnly property in DataGridCell. But unfortunately, that property is readonly! Is there any way to do it?
ant.

推荐答案

您应该能够使用 DataGrid.BeginningEdit 事件有条件地检查单元格是否可编辑,如果不是,则在事件参数上设置取消属性.

You should be able to use the DataGrid.BeginningEdit event to conditionally check if the cell is editable and then set the Cancel property on the event args if not.

这篇关于有条件地使 WPF DataGridCell 成为只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆