Search code examples
c#winformsdata-bindingdevexpresstextedit

DevExpress data bound TextBox clears/reverts value


I have a form with some data bound DevExpress TextEdits. I find it really strange that if I change the value and then change the focus to some other control, after a few seconds the value reverts to the first value when the form was loaded. I can't understand why this is happening..

The textedit is bound as follows:

textEdit_name.DataBindings.Add(new Binding("Text", person, "Name", true));

I have other textboxes bound in the same way, but there are no problems with them.

EDIT: It's the same if I use a normal winforms textbox, instead of DevExpress.


Solution

  • For DevExpress editors you must bind to BaseEdit.EditValue property instead of Text property:

    textEdit_name.DataBindings.Add(new Binding("EditValue", person, "Name", true));