Re: Привязка колекции обьектов к PropertyGrid
От: kisl0ta Украина  
Дата: 01.04.05 08:02
Оценка:
Здравствуйте, Аноним, Вы писали:


А>> Есть колекция обьектовкоторые содержат значения 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

А>ссылка на оригинальное сообщение
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.