WinForm DataBinding在business object c# .NET中隐藏属性

时间:2020-12-14 21:32:38

My datagrid (DevExpress) automatically will populate a grid based on the public fields of a business object.

我的datagrid (DevExpress)将基于业务对象的公共字段自动填充网格。

What attribute can I place on the field to tell WinForm databinders to ignore it?

我可以在字段中放置什么属性来告诉WinForm databinders忽略它?

[???HideFromDataBindingSources???]
 public bool IsSecurity
 {
     get { return _isSecurity; }
     set { _isSecurity = value; }
 }

1 个解决方案

#1


8  

You should decorate your property with Browsable(false)

你应该用可浏览的(错误)装饰你的财产

Or even implement ICustomTypeDescriptor in your class and filter or dynamically add properties in more agile way.

甚至在类中实现ICustomTypeDescriptor,并以更灵活的方式过滤或动态添加属性。

#1


8  

You should decorate your property with Browsable(false)

你应该用可浏览的(错误)装饰你的财产

Or even implement ICustomTypeDescriptor in your class and filter or dynamically add properties in more agile way.

甚至在类中实现ICustomTypeDescriptor,并以更灵活的方式过滤或动态添加属性。