Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1735
Multiple selection/edits in xamPropertyGrid
posted

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

Parents
  • 8576
    Offline posted

    Hi Leif -

    You can achieve scenario #1 by listening to 2 events on the XamPropertyGrid:

    • PropertyItemValueChanging (fired before property values are changed)
    • PropertyItemValueChanged (fired after property values are changed)

    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

Reply Children