WPF datagrid not updating first time
I have a WPF datagrid. The contents of the grid are bound to the SELECT result of a dataset. The grid is loading fine. Once the grid is loaded, I would like to specify an event in the WPF binding to update the contents of the grid (as well as the DB on the backend). This is working, but the first change is not being committed. If I go back a second time and change the same data item, I am seeing the FIRST change committed to the DB.
The XAML for my column appears in a datagrid called dgProducts. The column xaml is below
<my:DataGridTextColumn Header="Na开发者_运维技巧me" Width="Auto" Binding="{Binding ProductName, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus, Mode=TwoWay}" />
The SourceUpdated event of dgProducts is defined as:
prodAdapter.Update(dgProducts.DataContext.Data)
The Update method is generated from the dataset defined for the table which accepts ProductsDataTable as a parameter. This appears to be working, just one transaction behind. If I view the DataTable in debug mode I see the value change I made to the column it is just not committing.
Am I missing a refresh of some kind somewhere or is there something else being overlooked?
Thanks
SourceUpdated appears to be firing prior to the grid changes actually being committed. I used the CellChanged event, which worked properly.
精彩评论