I'm trying to make a simple form that contains textboxes that draw from a db in my project. I'm using the table adapter's GetData() method in the xsd file to populate the data context. I want to update one of these textboxes and have the changes reflected in the database. The textboxes populate fine, but the changes don't make it back to the db.
I have this code in my constructor for the window class
table = adapter.GetData();
this.DataContext = table;
And in the xaml, I'm binding to a listbox
<ListBox Name="lstItems" ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=name, Mode=TwoWay,
UpdateSourceTrigger=LostFocus}">
</TextBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I've been messing around with this for a while and just can't get it. It seems like it should be fairly simple. Am I incorrectly assuming that wpf can even do this type of databinding? Let me know if you need to know anything else. Thanks.