Hi,
i've got the problem where the user is typing some data in a cell and then clicks the save-button. While the cell stays in EditMode, the value will not be updated and in this case the value will not be saved.
Is there any possibility to change the value of a databound property on typing, so that the user can type something and then click save, and the value would be saved?
thanks
Alexander Kant
Hello Alexander,
Thank you for your post. I have been looking through it and I suggest you see the following forum thread:
http://community.infragistics.com/forums/p/57486/293270.aspx#293270
which discusses the same issue as yours. Please let me know if this is what you want to achieve or I have misunderstood you.
Looking forward for your reply.
Hello Stefan,
i tried this solution already, but the behaviour is still the same. Maybe i did a mistake, executing CommitChangesToActiveRecord-Command at the wrong time or something. Here is my code:
// register on ValueEditor.ValueChanged EventEventManager.RegisterClassHandler(typeof(ValueEditor), ValueEditor.ValueChangedEvent, new RoutedPropertyChangedEventHandler<object>(OnValueChanged));
// set the UpdateMode to OnUpdateUpdateMode = UpdateMode.OnUpdate; // executing CommitChangesTiActiveRecord command on value changedprivate void OnValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { this.ExecuteCommand(DataPresenterCommands.CommitChangesToActiveRecord); }Thanks, Alexander
i still need some advice. Could anyone help me please?
Thanks, Alex
Hello Alex,
I apologize for the late reply, but please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. I have been looking trough your post and it like I am missing something, since when you CommitChanges on the editor's value changed you get the same functionality as setting the UpadateMode property to UpdateMode.OnCellChange. I have created a sample project where there is a “Save” button which determines when the changes will be saved to the DataSource. Please let me know if this meets all your requirements or you need any further clarifications on this matter.
executing the CommitChangesToAllRecords command in the save commands was one of my first ideas, but i got the problem, that i've got a lot of different editors with save buttons in the whole application (some of the editors got multiple grids on it) and i'm afraid of implementing the ExecuteCommand call in every save button for every grid. Not to mention that i've got to implement this for each new grid i'll add to an editor.
Also i've inherited the XamDataGrid. So my intention was, if there's any kind of setting i could put in my base grid, so that the property of the business object bound to the cell would be updated immediatly while typing in it. With some solution like this, i wouldn't have to implement CommitChangesToAllRecords for each new grid or even each new editor i will create in the future.
Maybe there's some "clean" solution like a setting that would force the grid to update the property's value on typing.
One thing that you might try is to handle the CellChanged event (or since you have a derived version overriding the OnCellChanged method). Then you could do something like:
e.Cell.Record.SetCellValue(e.Cell.Field, e.Editor.Value, true);
Yeah, that works!
Thanks a lot, and have a nice day. :-)