This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Ivan,
I have yet another interesting situation. I have an object, which has several properties and a collection. The item in the collection is actually a thin wrapper around another collection (it is a dynamic object that is populated using our reflection system). In an effort to reduce the UI friction (that is, present the data so the user can access the information with minimal navigation) we want to display this collection flat in the property grid. GroupA |- Property |- Property |- Property GroupB |- Collection[0] |- Collection[1] |- Collection[2] Vs. GroupA |- Property |- Property |- Property GroupB |- Collection |- ThinWrapper |- Collection[0] |- ThinWrapper |- Collection[1] |- ThinWrapper |- Collection[2] To achieve this, I have tried two approaches. 1. Using an ICustomTypeDescriptor to add the items of the collection as properties. This works however is it limited to the fact you could not change the collection. You could force refresh of the GetProperties() by clearing/setting the SelectedObject however that is hackishâ„¢. 2. The second solution (as you can tell from the subject) is using the PropertyGrid.AddNode(...).I have read the previous posts on the forum and have implement the NodeToCategoryConverter that looks up a Dictionary to return a category name etc. This works really well. Unfortunately the second solution comes unstuck when I try to use both SelectedObject and try to add my own nodes. Inspecting the source code I notice that when you call BindObject you clear the internal nodes collection, which is destroying my custom nodes. Is this by-design? I would think that what I'm trying to do would be standard case. What do you recommend in this case? The option that I am considering is changing the in-built functionality to track custom nodes and ensure that they persist between SelectedObject changes. Is that sane? Or did I miss some important reason why you implemented it the way you did? |
|