Results 1 to 2 of 2

Thread: Simple way to display/edit custom class properties

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2004
    Location
    Kansas, USA
    Posts
    352

    Simple way to display/edit custom class properties

    I have a custom class. It is built from other custom classes. All the classes have properties that are basic types like integer, double or string. I want a simple way to display and edit the attributes of the class. I will be adding properties to the class as I am developing the app.

    I have looked at propertyGrid. It seems to do very well at simple top level properties. When it gets to a property that is a class of simple datatype properties then it just displays the class name grayed out.

    I am looking for a simple way to display and edit a custom class in a hierarchy that reflects the underlying class.

    Any ideas or pointers to custom controls out there?
    Thanks,
    Eric
    --------------------------------------------------------------------------------------------------------------------
    VB.net/C# ... Visual Studio 2019
    "None of us are as smart as all of us."

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Simple way to display/edit custom class properties

    That PropertyGrid control is the very same control that is used in the VS Properties window. As you can see, it handles composition without issue. What's required is a few attributes on appropriate types and/or members so that the PropertyGrid control knows to look inside the type of a property to see what it's made of. To be honest, I don't know exactly what attributes are required and where. I'm sure I've read it some time ago but it's not something that I've ever had to do so that information has been lost. That's what you need to look for though. If I had to do it myself, here's where I'd start:

    https://www.bing.com/search?q=proper...FDOUvqI7HkYHQW

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width