Ver Mensaje Individual
  #3  
Antiguo 18-09-2007
Avatar de Crandel
[Crandel] Crandel is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Parana, Argentina
Posts: 1.475
Reputación: 23
Crandel Va por buen camino
Hola Hector,

no consegui mucha info, pero en la pagina de MS sobre la clase System.ComponentModel.Design.Serialization.InstanceDescriptor daba un poco de info:

escribi el ejemplo que daban con pequeñas modificaciones y funciono. Aca dejo el código por si alguien tiene el mismo problema:
Código PHP:
 [TypeConverter(typeof(PlotLabConverter))]
    public class 
MyScopeClass Scope
    
{

        
internal class PlotLabConverter TypeConverter
        
{
            
// This method overrides CanConvertTo from TypeConverter. This is called when someone
            //  wants to convert an instance of Triangle to another type.  Here,
            //  only conversion to an InstanceDescriptor is supported.
            
public override bool CanConvertTo(ITypeDescriptorContext contextType destinationType)
            {
                if (
destinationType == typeof(InstanceDescriptor))
                {
                    return 
true;
                }

                
// Always call the base to see if it can perform the conversion.
                
return base.CanConvertTo(contextdestinationType);
            }

            
// This code performs the actual conversion from a Triangle to an InstanceDescriptor.
            
public override object ConvertTo(ITypeDescriptorContext contextCultureInfo cultureobject valueType destinationType)
            {
                if (
destinationType == typeof(InstanceDescriptor))
                {
                    
ConstructorInfo ci typeof(MyScopeClass).GetConstructor(new Type[]{});
                    return new 
InstanceDescriptor(ci, new object[]{});
                }

                
// Always call base, even if you can't convert.
                
return base.ConvertTo(contextculturevaluedestinationType);
            }
        }
    } 
__________________
[Crandel]
Responder Con Cita