TypeConverter for a PropertyGrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • moni

    TypeConverter for a PropertyGrid

    PropertyDescrip tor Class has a Converter method, which if overriden,
    would return a TypeConverter.

    I was working on dynamic values for a propertygrid, so for each
    property all the methods of the PropertyDescrip tor class were
    overridden. But for a dropdown list I needed the COnverter method
    also, but I dont know how I would do it?

    eg.

    public override Type PropertyType
    {
    get { return Type.GetType(it em.TypeName); }
    }

    returns a Type.

    public override TypeConverter Converter
    {
    get
    {
    return ?
    }

    }

    Please help. Any help will be appreciated.

    Thanx

  • Marc Gravell

    #2
    Re: TypeConverter for a PropertyGrid

    If you want the default converter for the type, then:
    TypeDescriptor. GetConverter(Pr opertyType)...

    However! Note that you don't need to override this; the default
    implementation will do the above as the default, but will also
    correctly support TypeConverterAt tribute if specified for the
    property. As a general rule, you don't need to provide all the
    functionality yourself...

    Marc


    Comment

    Working...