I need to change the editor for a property attached to a .net PropertyGrid,开发者_StackOverflow社区 but I cannot set the Editor attribute of that property, because the property was generated by a tool, including all attributes.
The desired editor is
System.Windows.Forms.Design.FileNameEditor
I can find many tutorials on the web to assign this editor to string properties by setting the editor attribute, but I cannot set the editor attribute in this case. However, I can advise the code generation tool to behave such that the string property which I want to be edited with the FileNameEditor becomes converted to another property with different type.
In order to do so, I would need to know which type is edited by the FileNameEditor as default. I didn't find any list on the web which would tell me for a given editor which types employ this editor automatically when displayed in a PropertyGrid.
This editor works with strings only and is not attached automatically to any other type.
According to Reflector, it's used only for 2 properties :
SqlConnectionStringBuilder.AttachDBFileName
OleDbConnectionStringBuilder.FileName
精彩评论