In my WPF App I've got a ListBox. This ListBox is bound to a Dataset(i used the Click-Drag Method onto the Window).
The Listbox has a DataTemplate, and the Elements(TextBox's) of this DataTemplate is Bound to the Columns of the Dataset.
All works well, the ListBox displays the information correctly. The Problem i'm having is with updating the Underlying Source bound to the objects.
The TextBox's UpdateSourceTrigger is set to LostFocus, and the Mode is set to TwoWay. When i edit the Text in the TextBox, and i click a way, the change reflects in the TextBox. When i close the application and open it again, value is reverted to what it was before the change.
I've even tried the "U开发者_运维技巧pdateSourceTrigger=Explicit" and "UpdateSourceTrigger=PropertyChanged" of the TextBox, but to no avail.
I've studied some examples I've found online and what they're telling me is what i am doing.
I just cant understand what i'm doing wrong?
After some digging and with some additional help from someone, i managed to figure out why my source wasn't updating.
I was unknowingly filling the Dataset(source) with old data after i changed the source.
I removed Fill() method from my code behind and my source was updating.
All that was left to do was to update the Database, which now works.
精彩评论