Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Created Unassigned: PropertyGrid: issues when SelectedObject implements INotifyDataErrorInfo [21153]

$
0
0
I'm using the PropertyGrid with various objects that implement INotifyDataErrorInfo. I was pleasantly surprised to find that the PropertyGrid hooks into this interface and displays a red border around the whole control if the SelectedObject is invalid; similarly it displays a red border around any individual properties that are invalid. However I have found a couple of issues relating to this:-

1) My object's property setters perform validation and updating the INotifyDataErrorInfo members accordingly, however after changing an invalid property value to a valid one, both of these red borders remain.

My workaround is to validate the entire object in the PropertyGrid's PropertyValueChanged event, but this highlights a second problem: the red border around the whole PropertyGrid disappears, but the red border around the property whose value has just been changed remains. My current workaround is to set SelectedObject to null then back to my object, which seems to refresh things.

2) The PropertyValueChanged event gets raised if I press Enter or if I click into a different property. However if I change a property's value then set focus to another control on the window, the underlying object's property gets updated but the PropertyValueChanged event does not fire, so I lose my "workaround" mentioned earlier. The PropertyGrid.LostFocus event doesn't seem to fire either, so I'm at a loss as to how else I can trap this situation.

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>