Add custom properties to propertygrid object in powershell

I want to use the System.Windows.Forms.Property grid to display a number of key value pairs within a Powershell generated GUI.  

[void] [System.Reflection.Assembly]::LoadWithPartialName("System,Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

$pGrid = New-Object System.Windows.Forms.PropertyGrid


$pGrid.SelectedObject = MyCommand | Select @{N="Hello"; E={$_.Greeting}}

Open in new window

When loaded this displays the property grid and contains the expected key/value pair of Hello/Greeting. This all works fine but I would like to categorise the key/value pairs (so the above might come under a "General" category). How can I add values to the propertygrid and assign them to a category (creating the category if doesnt already exist)? Also properties usually come with a description so it would be good to set this also - if not hiding the property description panel would be good.

Any experts out there that can help with this will save my bacon!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I don't have a lot of experience with PowerShell, but you are using the PropertyGrid, which is in the framework, which I do know.  The challenge for me would be to put that knowledge into a context that will work in PowerShell.

Here is an article that explains how to customize the display of an object in the PropertyGrid.  It shows how to use  TypeConverter, PropertyDescriptor, and ICustomTypeDescriptor to customize how the object interacts with the PropertyGrid.

Customized display of collection data in a PropertyGrid

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.