Is there a DataObjectChanging like event?

Posted 1 year ago by Avatar Imre Lengyel

We have a scenario where with a property grid, we want to maintain the focused property when changing the DataObject. For this we would store the property path and re-focus after the new DataObject is set.

I see the RootItemChanged event for the second part of the solution, but I do not see a place to hook for the first part to capture the current focused property.


Comments (8)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA

Hi Imre,

There isn't a pre-change event just yet, but we will add a RootItemChanging event for the next version.  Thanks for the suggestion.

Actipro Software Support
Information The latest build of this product (2018.1 build 0672) was released 27 days ago, which was before the next post in this thread.
Posted 14 days ago by Wiley Knoch

Was this ever added to the roadmap and completed?  I am ugrading from 16 - 18 now to use the new grid and lost the selection items changed to have the old and new DataObjects and still don't see an event like this.

Posted 14 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Wiley,

We did added it but after doing some testing with another customer, we found it wasn't helpful since by the time the RootItemChanging event fired, the new item was already assigned. 

What specifically were you looking to track, the old selected item?

Actipro Software Support
Posted 14 days ago by Wiley Knoch

Correct I need access to the old and the new.  The previous property grid used the selected items changed even which supplied both so I can hook up some of my specialty event tracking and didn't see anything in the new version with a similar event.

Posted 13 days ago by Imre Lengyel

Hi Wiley,

Quite a memory test, but from what I remember, we had to handle capturing the prop grid state before updating the DataObject property, and best effort re-apply state after the set.

I have seen another solution where proxy object is used for the data object, which has the advantage of reducing some flicker when changing objects, but in that solution the properties in data objects were flat, and the property shape of the objects were the same.

Posted 13 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Wiley,

I believe the SelectionChanged event (defined on the base TreeListBox class) does pass a SelectionChangedEventArgs that specifies removed and added items.  In the case of PropertyGrid, those items will be data models like IPropertyModel.

Actipro Software Support
Posted 13 days ago by Wiley Knoch

SelectionChanged event is now fired when the actual selection changes in a property grid, clicking on different properties in the grid.  Before this event was fired when the SelectedObjects changed which is now be changed to DataObjects in the new grid.  I have a work-around in place using the OnItemsSourceChanged override but it is hacky and was just wondering if the question asked in this inital post had been addressed yet.

Posted 12 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Wiley,

The SelectionChanged event should still be getting fired as new DataObjects are set, even in the new PropertyGrid.  

We don't yet have anything built-in for the original question.  We have a TODO list item for that and I've added your request to it.

Actipro Software Support

Add a Comment

Please log in to a validated account to post comments.