How to use PropertyGrid for XML files?

Oct 24, 2011 at 3: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 1:35 PM

I think what you are looking for is a PropertyBag.

Oct 25, 2011 at 2: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 2: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 3:05 PM

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