I have a datagridview with competitor information. I display all the properties of the committer in the PropertyGrid. I want some of these properties (e.g. Degree, City, Institute) to be empty with values taken from the database. For this I can create a custom TypeConvertor similar to this
class DegreeTypeConverter : StringConverter { static string[] _valueList = { "Bachelor", "Master", "Student" }; public override bool GetStandardValuesSupported( ITypeDescriptorContext context) { return true; } public override bool GetStandardValuesExclusive( ITypeDescriptorContext context) { return true; } public override StandardValuesCollection GetStandardValues( ITypeDescriptorContext context) { return new StandardValuesCollection(_valueList); } } [TypeConverter(typeof(DegreeTypeConverter))] public string Degree { get { return _degree; } set { _degree = value; } }
But I want to get this valueList from the database, and I have 14 such properties, so some kind of universal converter will be much better than 14 converters with the only difference: valueList. Is it possible to create a TypeConverter with the variable valueList (for example, passed to TypeConverter as a parameter in the constructor)? Or maybe there is another way to have a variable value dropbox in the PropertyGrid? Hope this was clear enough Thnx in advance
Sasha grinevich
source share