1
如果我將對象分配給PropertyGridControl.SelectedObjuect then I can use [PasswordPropertyTextAttribute(true)] for the password property並且效果很好。如何在DevExpress PropertyGridControl中使用密碼字符
但是我通過實現ICustomTypeDescriptor如下,這沒有任何影響的對象:
AttributeCollection ICustomTypeDescriptor.GetAttributes()
{
AttributeCollection attrColl = TypeDescriptor.GetAttributes(this, true);
Attribute [] attrs = new Attribute[attrColl.Count + 1];
attrColl.CopyTo(attrs, 0);
attrs[attrs.Length-1] = new PasswordPropertyTextAttribute(true);
return new AttributeCollection(attrs);
}
有沒有辦法做到這一點?我們正在使用Windows Forms & C#。
相關:http://stackoverflow.com/questions/11892064/propertygrid-with-custom-propertydescriptor –