Hi,
I have two questions regarding selection/editing of multiple objects in the xamPropertyGrid:
1. When a property is edited in multiple selection mode, is there a way (an event?) to tell me when the first effected object's property is updating and the last effected property has been updated? The reason I need this is that I use an undo/redo manager for the edited objects, and I want all edits in a multiple selection edit to be encapsulated in the same undo/redo transaction. I therefore need a way to be able to set up and commit such transactions.
2. In multiple selection mode, is there a way to tell the property grid that a property should not be available for multiple selection edit? Although multiple selection edit works well in most cases, I have object properties that should only be allowed to be edited when no other objects are selected.
Regards,Leif
Hi Leif -
You can achieve scenario #1 by listening to 2 events on the XamPropertyGrid:
When there are multiple objects selected in the XamPropertyGrid, the events are fired before the first object is modified and after the last object is modified respectively. When there is only a single selected object, they are fired before and after the property on the single object is modified.
As for scenario #2, there is currently no way to effectively treat a property as 'read only' when it exists on an object instance that is currently part of a multiple selection. This would have to be entered as a Product Idea.
I'm curious about the behavior you would expect in the UI for this scenario #2 - would you expect that such properties would just refuse to enter edit mode when there is a multiple selection or that edit mode would be active but a message would be displayed when the user attempts to commit the value indicating thet 'This property cannot be modified when there are multiple objects selected'?
Joe
Scenario #1: Thanks, the PropertyItemValueChanging/PropertyItemValueChanged events seem to work the way I need. From the documentation I got the impression that these were called on an item by item basis, but tests show that these are indeed called only once in a multiple edit scenario.
Scenario #2: The behavior I would expect is that these properties turn into read-only properties in a multiple-select context. In my current scenario, these properties are typically collection-type of properties. E.g. a custom attribute to state that a property should be read-only in a multiple-select context would be nice.