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
|
Hello, i have an object of type XMLElement in which i have attributes collection with key and value. how can bind this object with the property grid. Is there any way to bind the object in property grid's SelectedObject.
Regards Raghuraj |
|
|
Using an XmlElement as the SelectedObject directly won't work because it has all sorts of other properties that you probably don't want to expose, and the property grid doesn't know how to handle the Attributes collection. Our recommendation would be to build a generic adapter class that exposes a set of properties that you would like your users to see (perhaps using ICustomTypeDescriptor to wrap the attributes in "fake" properties), and maps their implementations onto the underlying XmlElement. If the Attributes collection is the only thing you want to edit, you can get away with building a very simple adapter from an XmlAttributeCollection to an IDictionary<string, string>, and using PropertyGrid.ItemsSource instead of PropertyGrid.SelectedObject. |
|