DataGridViewButtonColumn

DataGridViewButtonColumn

本文介绍了DataGridViewButtonColumn启用按钮结合布尔字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义对象(比如为MyObject )使用名为的IsEnabled 一个布尔属性。我约束的为MyObject 集合到的DataGridView 设置 DataPropertyName 对于每一列

I have a custom object (say MyObject) with a bool property called IsEnabled. I bound a collection of MyObject to a DataGridView setting the DataPropertyName for each column.

我想通过的IsEnabled 属性的值,以便在 DataGridViewButtonColumn 按钮。我怎样才能得到这一点没有实现自定义列?这可能吗?

I'd like to enable the buttons in a DataGridViewButtonColumn by the value of the IsEnabled property. How can I obtain this without implementing a custom column? Is it possible?

现场绑定到它不工作列...

Binding the field to the column it doesn't work...

推荐答案

看来,在一个 DataGridViewButtonColumn 不能被禁用,因此,下面的这篇文章,唯一的办法按钮获得我想要的是实现一个自定义的DataGrid列类型: http://msdn.microsoft.com/en-us/library/ms171619.aspx

It seems that buttons in a DataGridViewButtonColumn cannot be disabled, so, following this article, the only way to obtain what I want is to implement a custom DataGrid column type:http://msdn.microsoft.com/en-us/library/ms171619.aspx

不是很实用...

这篇关于DataGridViewButtonColumn启用按钮结合布尔字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 05:07