Hello,
I have a collection of objects bound to a XamDataGrid.The collection exposes the CurrentItem which is synchronized with the Grids current item.
The item class implements IEditableObject, and the Undo and Database-Store operations are coded in the interfaces implementation.
One property (containing large text amounts) I need to bind to an external TextBox (not within the grid).It is bound to MyModel.ItemCollection.CurrentItem.TextProperty
When I edit the item with the grid, the undo and storage operations work all well.I even can edit the text in the external TextBox, but this will only be saved when I also edit any property on the current item in the grid.
What I want:As soon I start typing in the TextBox, and the record was not in EditMode before,the Grid should start into EditMode.When I simply call Item.BeginEdit the Grid is not informed about this operation at all.
Is there a known solution for this situation?
Thank you.
Thank you for your post. I have been looking into it and I can say that you cannot have two items focused at the same time and when you start typing in your Textbox you are not able to put a particular cell from the XamDataGrid in edit mode without losing the focus of the Textbox. Please let me know if you have further questions on this matter.
Looking forward for your reply.
Hello Stefan,
I do not want to focus the grid or force any cell into editMode.When I start editing a record in the gid, the left side record marker becomes a star symbol and IEditableObject.BeginEdit is called on the data object.This logical state change I want to trigger external from the grid if the record, which is currently selected within the grid, is about to edited from other controls.
What I do for now is: - when an external control edits the object, call IEditableObject.BeginEdit if EditMode=false so far. (the grid does not know about it) - when the current record changes within the grid, call IEditableObject.EndEdit if EditMode=true, so any changes are stored.
This emulates the editing feeling from ms-access forms, where manual saving is never needed.The only disadvantage is the missing editing indicator within the grid when modifying from external controls.
Maybe you can suggest a better solution.Thank you!
I have been looking into your approach and I think that for the moment it is the best one. If I think of a better one I will let you know.