Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Problem with Property Grid

Problem with Property Grid

Scheduled Pinned Locked Moved C#
helpcsscom
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rajeevktripathi
    wrote on last edited by
    #1

    Hi All I am using PropertyGrid to show the properties of object.. want to use property grid with combo box and taking help from this MSDN link.. http://msdn2.microsoft.com/en-us/library/aa302326.aspx here is the code that I am using.. using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; namespace PropertyGridTest { [DefaultPropertyAttribute("Person")] class Person : StringConverter { public Person(string inName, string inAddress, int inAge, bool inEmployed) { name = inName ; address = inAddress ; age = inAge ; employed = inEmployed; } public Person(string inName) { name = inName; } private string name; private string address; private int age; private bool employed; public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return true; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(new string [] {"AAA", "BBB", "CCC", "DDD" }); } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } [TypeConverter(typeof(Person)), CategoryAttribute("Person Details"), DescriptionAttribute("Name of the Person")] public string Name { get { return name; } set { name = value; } } [CategoryAttribute("Person Details"), DescriptionAttribute("Address of the Person")] public string Address { get { return address; } set { address = value; } } [CategoryAttribute("Person Details"), DescriptionAttribute("Employed")] public bool IsEmployed { get { return employed; } set { employed = value; } }

    L 1 Reply Last reply
    0
    • R rajeevktripathi

      Hi All I am using PropertyGrid to show the properties of object.. want to use property grid with combo box and taking help from this MSDN link.. http://msdn2.microsoft.com/en-us/library/aa302326.aspx here is the code that I am using.. using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; namespace PropertyGridTest { [DefaultPropertyAttribute("Person")] class Person : StringConverter { public Person(string inName, string inAddress, int inAge, bool inEmployed) { name = inName ; address = inAddress ; age = inAge ; employed = inEmployed; } public Person(string inName) { name = inName; } private string name; private string address; private int age; private bool employed; public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return true; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(new string [] {"AAA", "BBB", "CCC", "DDD" }); } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } [TypeConverter(typeof(Person)), CategoryAttribute("Person Details"), DescriptionAttribute("Name of the Person")] public string Name { get { return name; } set { name = value; } } [CategoryAttribute("Person Details"), DescriptionAttribute("Address of the Person")] public string Address { get { return address; } set { address = value; } } [CategoryAttribute("Person Details"), DescriptionAttribute("Employed")] public bool IsEmployed { get { return employed; } set { employed = value; } }

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      rajeevktripathi wrote:

      Person : StringConverter

      Your class should not derive from a TypeConverter, rather use the TypeConverter attribute to decorate the 'Person' class.

      **

      xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
      New xacc.ide release RSS feed^

      **

      R 1 Reply Last reply
      0
      • L leppie

        rajeevktripathi wrote:

        Person : StringConverter

        Your class should not derive from a TypeConverter, rather use the TypeConverter attribute to decorate the 'Person' class.

        **

        xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
        New xacc.ide release RSS feed^

        **

        R Offline
        R Offline
        rajeevktripathi
        wrote on last edited by
        #3

        HI Thanks for your reply... Please tell me that how to decorate Person class from TypeConverter attribute but in the MSDN link learened that I have to derive my class from the TypeConverter ... So PLease help me in resolving the problem... Thanks & Regards

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups