Hi,
I'm editing records in a datagrid, using a kind of popup control. On the control I have some XamEditors. Basically I reuse the form anytime I want to do something. I put my controls in IsAlwaysInEditMode.
When I change or add a record, and select another (bind the dataitem of the grid to my popup control) I get the funny behaviour that the value I entered previously is still stored as OriginalValue. This is ofcourse not the behaviour I would like. It would be nice if I could reset the XamTextEditor.. I could remove the control and instantiate it again but then what do I use XAML for? ;-)
Some input would be appreciated here, thanks:)
This seems like a bug. You should report this issue to the support group. Since the control is always in edit mode, its not updating the OriginalValue when the Value is set. This is correct when logical focus is within the editor but when it doesn't have logical focus then it should have updated the OriginalValue.
So you mean if the control is set to IsAlwaysInEditMode, it shouldn't keep a reference to the OriginalValue?
I noticed this when I pressed escape in the 'previously' used texteditor, and I assumed that pressing escape would set the value back to the original value. Is this a correct assumption?
No that's not what I mean. What I mean is that if IsAlwaysInEditMode is true and the Value property is changed while logical focus is not within the control then it should update the OriginalValue - it does do this if its not in edit mode.
Yes, the OriginalValue is used when pressing Escape to revert to the original value. For an editor that is now always in edit mode, this value is captured when it enters edit mode (as well as when the Value changes while its not in edit mode).
So as I mentioned in the previous reply, you should report this issue to the support group that the OriginalValue was not changed for the editor when its Value was changed while it didn't have focus (in your case because you changed the associated datacontext) because its IsAlwaysInEditMode was true.
Right, I get it now, thanks.