Hi all
I created Collection + CollectionItem classes and a TypeConverter in order
to persist the items in the collection. I then added descendants of these
classes (ImageCollection, ImageItem).
The persistence etc works fine until I add a property to the descended
class, and then the created items do not appear in the collection editor
list. Anyone have any ideas?
internal class CollectionItemConverter: TypeConverter
{
public override Boolean CanConvertTo(ITypeDescriptorContext context, Type
destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
return true;
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context,
System.Globalization.CultureInfo culture, object value, Type
destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
System.Reflection.ConstructorInfo ci =
value.GetType().GetConstructor(System.Type.EmptyTy pes);
return new InstanceDescriptor(ci, null, false);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
--
Pete
=============
Read or write technical articles
http://www.HowToDoThings.com
Audio compression components, FastStrings library, DIB controls
http://www.DroopyEyes.com
-There are 10 types of people in the world, those who understand binary, and
those who don't