Hi, I'm developing a system that uses the new XamPropertyGrid to visualize (and I'm thinking also to edit if possible) the details of some classes
some of the classes have the following format
MyProperty1
Myproperty2
MyCollection1
Element1
Element2
Element3
The Mycollection1 is correctly shown but its elements are shown in the following format
[0]
ElementProperty1
ElementProperty2
The collection elements in my case are objects containing a Name and a Value and are Dynamically created on the objects.Is there a Way to tell the Property Grid to show (maybe the ToString) instead of the [0] so that the effect will be more User friendly?
I make an example: The Object is a Project, The Collection is an accessory information data the content of the property grid I'd like to have is the following:
ProjectName StarTrek
FileName StarTrek.proj
Folder C:\Startrek
Revision 1.0
+ AdditionalInfo
+ Order 12345
Name Order
Value 12345
+ DeliveryDate 06/01/2015
Name DeliveryDate
Value 06/01/2015
This will allow to use the property grid in several scenarios and avoid the need to develop a specific User control or window to visualize the data and modify them.
Thank you in advance
I add some more information,
After writing you, remembering that you told me that the property grid uses what Implemented by Microsoft about the property grid, I've added to my collection class and collection element the implementation of the Customized property descriptor with its interface and classes, this implementation in windows forms property grid allows to obtain what I wanted.
Unfortunately, the XamPropertyGrid does not react to the implementation and the collection has still the index numbers instead of the data given by the customized property descriptor. If you have any hint on how to resolve the issue,
thank you in advance
Hi Sabrina,
As you have pointed out, it doesn't look like the XamPropertyGrid supports that requirement. I believe internally the property grid just displays each item in a collection by it's index "[0], [1], etc.". I recommend submitting this as a new product idea for the XamPropertyGrid here: http://ideas.infragistics.com as it would be a pretty cool addition to the control.
Hello Brian,
I am attaching an example that achieves the above. In order to display the child items in this case, a custom collection is derived, which implements the ICustomTypeDescriptor interface - in the case of this sample, the collection is named "ChildCollection."
Each of the elements inside this collection have a custom PropertyDescriptor returned for them in the ChildCollection.GetProperties() method override. These PropertyDescriptors modify the DisplayName for the "ChildData" items that are added to the "ChildCollection." which reflects in the XamPropertyGrid.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
XamPropertyGridDisplayModDemo.zip
Is there an example on how to enable or setup this new feature?I am using WPF XampGropertyGrid 17.1. I don't want to open up a case if it's just a simple example somewhere.
This feature will be available in the upcoming 15.2 release which is targeted for an Oct timeframe.