This project has moved and is read-only. For the latest updates, please go here.

How to use PropertyGrid for XML files?

Oct 24, 2011 at 4:33 PM

I am assuming you are trying to use the default editors when your property is of type Object.

In order to do this you can try implementing the ICustomTypeDescriptor interface, or use the Editor attribute on your properties.

Oct 25, 2011 at 2:35 PM

I think what you are looking for is a PropertyBag.

Oct 25, 2011 at 3:13 PM

Sorry, but it's not as simple as making the PropertyGrid properties public.  The PropertyGrid does support dynamic objects/ properties.  The code you provided works for me.  An object was created of type MyDynamicType and the Number property was displayed with the proper IntegerUpDown editor.  You should also look into the ICustomTypeDescriptor interface.

Oct 25, 2011 at 3:45 PM

That is probably because that particular demo only displays properties with the names of FirstName, FavoriteColor, and PetNames (check the XAML).  Since your property was named Number, it would not be displayed.  Hence the demo is named "Specifying Properties" :0)

Oct 25, 2011 at 4:05 PM

No problem.  You can thank me by rating the project with your impressions.