Здравствуйте, Аноним, Вы писали:
А>> Есть колекция обьектовкоторые содержат значения Name и Value, ессественно их количество не известно. Необходимо привязать их к PropertyGrid. Каким образом это сделать?
А>
А>
А>[TypeConverter(typeof(MyConverter))]
А>class MyClass
А>{
А>}
А>public class MyConverter : TypeConverter
А>{
А> public override bool GetPropertiesSupported(ITypeDescriptorContext context)
А> {
А> return true;
А> }
А> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
А> {
А> MyClass mc = value as MyClass;
А> PropertyDescriptor[] parr = new PropertyDescriptor[mc.Count];
А> // наполняем parr элементами MyPropertyDescriptor
А> PropertyDescriptorCollection ret = new PropertyDescriptorCollection(parr);
А> return ret;
А> }
А>}
А>public class MyPropertyDescriptor : PropertyDescriptor
А>{
А> // ...
А>}
А>
данное сообщение получено с www.gotdotnet.ru
А>ссылка на оригинальное сообщение