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
|
I'm considering using a dictionary & using PropertyGrid.ItemsSource to represent a concrete object + some auxillary data. The problem I'm running into is figureing out the best way to process the property changed to pass those onto my concrete object. I could just use the PropertyChanged event on the ObservableDictionary, but that doesn't tell me which property was changed; meaning I have to iterate through the dictionary, the auxillary data, & the object to figure out the value that's changed. Another option I can think of would be to implement a wrapper for my data & object that would implement IDictionary. Any suggestions? |
|
|
What you need is the CollectionChanged event. When the user edits an item in the grid, CollectionChanged will be raised with the following event arguments: Action: Replace You can therefore use the key to identify which property was changed, e.g. var property = ((KeyValuePair<TKey,TValue>)(e.NewItems[0])).Key; where TKey and TValue are the key and value types of your ObservableDictionary e.g. string and object. |
|