属性描述符如何获取两个不同绑定字段的属性?

时间:2013-03-15 14:23:18

标签: c# gridview webforms

我只能说.Find("boundField", true)

,无法理解属性描述符如何获取两个不同的绑定字段的属性

这是一个例子

PropertyDescriptor propertyA = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true);
PropertyDescriptor propertyB = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true);

两行代码都是相同的,当我调试时它们会返回null但是当我尝试从它们中取出这样的值时,它们会给出不同的值(这是正确的),这怎么可能呢? ?

PropertyAFieldValue = this.GetValue(control.NamingContainer, this._PropertyAField, ref propertyA).ToString();
PropertyBFieldValue = this.GetValue(control.NamingContainer, this._PropertyBField, ref propertyB).ToString();

对于其他代码,请查看How can Property Descriptor gets values of two controls using same code line?

0 个答案:

没有答案