Auto-update property grid when it loses focus

Grids for WPF Forum

Posted 14 years ago by Michael Nugent
Version: 9.1.0505
Avatar
Hi,

Not sure if this is expected behavior, but we have a user action we would like to handle: when they make a change to a property value (string) for a selected object and then select another object on the screen (w/o pressing enter before selecting the second object). If the user then selects the first object, the initial change made does not show in the property grid until the user selects that another property in the grid (it seems then the onchange event is fired). At times the change is completely lost (depends on what is clicked and in what order). We are currently overriding the Keydown event to force an update when the enter key is pressed. Is there a way to force an update when a user leaves the property grid after making a change but without hitting the enter key?

Thanks,

Mike


[Modified at 07/21/2010 12:11 PM]

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mike,

This really depends on the underlying property editors used. In general, anything the user enters will not be committed back to the underlying object until the focus is moved. This is because most default property editors, and WPF controls such as TextBox, default to using UpdateSourceTrigger.LostFocus.

You can use custom property editors that use UpdateSourceTrigger.PropertyChanged, to push changes back immediately. The problem with this is incomplete data may be pushed back, while the user is still typing. Alternatively, you can move the focus out of the editor, using something like "this.propertyGrid.Focus()", before changing the selected object.


Actipro Software Support

Posted 14 years ago by Michael Nugent
Avatar
Setting focus before changing the selected object(s) works perfectly!

Thanks,

Mike
The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.